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.8 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 DDE3CC4338F for ; Thu, 29 Jul 2021 11:58:51 +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 4879660720 for ; Thu, 29 Jul 2021 11:58:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 4879660720 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 DCDAB82E68; Thu, 29 Jul 2021 13:58:48 +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="sOaL150+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C366682E6A; Thu, 29 Jul 2021 13:58:45 +0200 (CEST) Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [IPv6:2a00:1450:4864:20::62d]) (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 BF00082E05 for ; Thu, 29 Jul 2021 13:58:42 +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=bmeng.cn@gmail.com Received: by mail-ej1-x62d.google.com with SMTP id o5so10285051ejy.2 for ; Thu, 29 Jul 2021 04:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=LNkEQGSDsfwy6GBu+L/mPB9VAtJ3xHwa/NhM9/AO85I=; b=sOaL150+gHkTVi6gQ+x1BeKVmEoVnmdjHqROdQb3navizbAIEm6kYDmMmpJARvCbOF JNcHxEIKnk51PeJcaUagK0cer14FXYz9CrqjbDChs21dGVfhZn12sIKexe++D3CjXuqg aiMA2iPGcQfOH4lAvY6nJt7/+WdXD6loHt67OWpOXGZakyd5kY4Wbyn7zEJnLH1f7s0S 3C0pSXOx8rRyLZJ0oytNsIwXbNfkH9U7bsA3fRuHsyUa0dzWvclzjPclu3GJ4xupvbRa TVqTUdlVoL15mYDoyNg17XbutbvgvLugD3hFL33RtmKReK8B0sIZjcJ1JYBiHM1jAtNI nuJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LNkEQGSDsfwy6GBu+L/mPB9VAtJ3xHwa/NhM9/AO85I=; b=MmROKMBF9uQ3SLAEg9s3Ua7N62uc+08dw2oEpimGwNKCWwobFA/sqMBADnBGiWueie /Dkn9DE6Z5eMZbEivdS6mOPnGrU4lfq6W5UB5h2eP/I7rtwPCIgycFX2xLymd5chkdNj nAeR0zopmRfLLXVCcUoybFj3bcFhdjo2K0jTn+/Nve/LflooF7cT8KbUqry5vwlnAkw+ 9uUZ5psskyCIHk/6jbTbyx/LTbmNbjtKyG+wnuqiw4zvYKjzkZu0u2Pqg4VmSP4T0s/y VI4Z6qkF1KjZ9vvfVuPgUHrnkErTKh+IGLBMv95dgIBRh5uKe5HJ6AHMJ28FUV4+lN4Y 5Bqw== X-Gm-Message-State: AOAM530RSYshc6zcaXQBaTapO4oj73teHguvKSExTwyOU1mxDZ2oLY4k OSLdNZXHJF/d6KpBrmbfgp0= X-Google-Smtp-Source: ABdhPJxQnHAenhCd9PcBEH3jsBCsofejfGu0YmXnziQ8SMXOTDG7/3lWPWDZEW4aqq14YdMg7CrDrA== X-Received: by 2002:a17:906:c304:: with SMTP id s4mr4206675ejz.346.1627559922393; Thu, 29 Jul 2021 04:58:42 -0700 (PDT) Received: from pek-vx-bsp2.wrs.com (ec2-44-242-66-180.us-west-2.compute.amazonaws.com. [44.242.66.180]) by smtp.gmail.com with ESMTPSA id n13sm1134997eda.36.2021.07.29.04.58.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Jul 2021 04:58:41 -0700 (PDT) From: Bin Meng To: Jagan Teki , Vignesh Raghavendra , Pratyush Yadav , u-boot@lists.denx.de Subject: [PATCH 2/2] mtd: spi-nor: Mask out fast read if not requested in DT Date: Thu, 29 Jul 2021 19:58:27 +0800 Message-Id: <20210729115827.603282-2-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210729115827.603282-1-bmeng.cn@gmail.com> References: <20210729115827.603282-1-bmeng.cn@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 The DT bindings of "jedec,spi-nor" [1] defines "m25p,fast-read" property to indicate that "fast read" opcode can be used to read data from the chip instead of the usual "read" opcode. If this property is not present in DT, mask out fast read in spi_nor_init_params(). This change mirrors the same logic in spi_nor_info_init_params() in drivers/mtd/spi-nor/core.c in the Linux kernel v5.14-rc3. [1] Documentation/devicetree/bindings/mtd/jedec,spi-nor.yaml in the kernel tree Signed-off-by: Bin Meng --- drivers/mtd/spi/spi-nor-core.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 2883d092fc..d6a0ed39c5 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -2597,6 +2597,8 @@ static int spi_nor_init_params(struct spi_nor *nor, const struct flash_info *info, struct spi_nor_flash_parameter *params) { + struct spi_slave *spi = nor->spi; + /* Set legacy flash parameters as default. */ memset(params, 0, sizeof(*params)); @@ -2604,18 +2606,25 @@ static int spi_nor_init_params(struct spi_nor *nor, params->size = info->sector_size * info->n_sectors; params->page_size = info->page_size; + if (!(info->flags & SPI_NOR_NO_FR)) { + /* Default to Fast Read for DT and non-DT platform devices. */ + params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; + + /* Mask out Fast Read if not requested at DT instantiation. */ + if (!ofnode_read_bool(dev_ofnode(spi->dev), "m25p,fast-read")) + params->hwcaps.mask &= ~SNOR_HWCAPS_READ_FAST; + } + /* (Fast) Read settings. */ params->hwcaps.mask |= SNOR_HWCAPS_READ; spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ], 0, 0, SPINOR_OP_READ, SNOR_PROTO_1_1_1); - if (!(info->flags & SPI_NOR_NO_FR)) { - params->hwcaps.mask |= SNOR_HWCAPS_READ_FAST; + if (params->hwcaps.mask & SNOR_HWCAPS_READ_FAST) spi_nor_set_read_settings(¶ms->reads[SNOR_CMD_READ_FAST], 0, 8, SPINOR_OP_READ_FAST, SNOR_PROTO_1_1_1); - } if (info->flags & SPI_NOR_DUAL_READ) { params->hwcaps.mask |= SNOR_HWCAPS_READ_1_1_2; -- 2.25.1