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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F5C5C433F5 for ; Mon, 18 Oct 2021 11:31:54 +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 939E261077 for ; Mon, 18 Oct 2021 11:31:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 939E261077 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 0B0DA834F1; Mon, 18 Oct 2021 13:31:29 +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="HzEsAky5"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 33832833E4; Mon, 18 Oct 2021 08:25:03 +0200 (CEST) Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) (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 2B440829FC for ; Mon, 18 Oct 2021 08:24:59 +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-pg1-x535.google.com with SMTP id q5so15033837pgr.7 for ; Sun, 17 Oct 2021 23:24:59 -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=t3GO6p/MGGjm3U9nhFVJglrpz3GYKt4sVG9SmyJmhCQ=; b=HzEsAky5jcEa7VJtQAoeepDnZQ7+CM4t4uVKrf/+UIjxw6IVuoNsbERzJBfZPwqSWI cOxvuBWDA2k0pFQ6qrfVMOTOPisZT6uhA9zeX8jqAVGcUgwUongzrIQuHeP9SJyKcv4A O9cL4pKxIP1rzI58LwYOIWpRqlrig9jWYG4MXBAwRCTY0BmK3y3IJTU1uehHtR7uBuIr j0MCjLQfIjCy6vO9K/lKu6196+CecCu9/J3nVDiIYFtwxmDsHv+ZFAW7m8Y2x/OuJ/09 aGe0S1VmlFN2vmCGkCRVCCpyHZI+BlkZ2axAF2orROyc0DPhknxMePq6y0gWIAb6aioz Sm5A== 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=t3GO6p/MGGjm3U9nhFVJglrpz3GYKt4sVG9SmyJmhCQ=; b=zqHWrnXaoi8dH+brrayTktgVyQ3tbv0sQB/g5d2FDsyK5Mv1jqdzGJnLjjGwUCMaUs Tw+7T8iBaJIg6vxYyAq6dEPUaFwp+wEcK8PACM6OFR4D/YZkQHMaJXkpXU3foWXnPydv NLaE3df0JMi4lWcJMKrQ8lPezQqPSIlCrkkEuD59pOiUYQGRQ94sXLX0rVhF89olhgYa eNNHDnVltEeFyq7c2/9e+jIvWPIauuj6QgmdsKrSiedzMSkOQH53Lp1GRibMQQIAXGGF LhpssEDhqfOP+Bwpywve6D1palQ5o+SkAfp3wB7PU/a9a27l2T7eiQdLuWNehqWI1YrX uPMA== X-Gm-Message-State: AOAM531AnuXciUaRS0rHTT6n1lG6PR+iJsnez3dqX+R+/kwi4i7KbJre O1eZ+1mZlKS/Wyv4k7tYh0UyrhRt7S0= X-Google-Smtp-Source: ABdhPJyHSbEct+H6ci9B1yU95zRal0QWFVHlKKGdlsPnho9VZ08ybeuKYfnG0jxJgeQDSxUjTXup8g== X-Received: by 2002:a05:6a00:c1:b0:44c:ec40:b47 with SMTP id e1-20020a056a0000c100b0044cec400b47mr27092701pfj.76.1634538297430; Sun, 17 Oct 2021 23:24:57 -0700 (PDT) Received: from localhost.localdomain ([123.51.145.88]) by smtp.gmail.com with ESMTPSA id q9sm7124939pfj.88.2021.10.17.23.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Oct 2021 23:24:57 -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, jaimeliao@mxic.com.tw, JaimeLiao Subject: [PATCH v4 3/4] mtd: spi-nor-core: set 4byte opcode when possible Date: Mon, 18 Oct 2021 14:24:27 +0800 Message-Id: <20211018062428.4201-4-jaimeliao.tw@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20211018062428.4201-1-jaimeliao.tw@gmail.com> References: <20211018062428.4201-1-jaimeliao.tw@gmail.com> X-Mailman-Approved-At: Mon, 18 Oct 2021 13:30:59 +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 87a7de7d60..7d6671ade2 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) -- 2.17.1