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 60B73C432BE for ; Wed, 28 Jul 2021 15:56:24 +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 A4E876101B for ; Wed, 28 Jul 2021 15:56:23 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A4E876101B 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 8976D82C88; Wed, 28 Jul 2021 17:56:21 +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="l3gPiAbR"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1F8F782C89; Wed, 28 Jul 2021 17:56:20 +0200 (CEST) Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) (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 48FB282C5D for ; Wed, 28 Jul 2021 17:56:17 +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-x629.google.com with SMTP id v21so5438992ejg.1 for ; Wed, 28 Jul 2021 08:56:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=GxDy29POy0wkxLFsYTGkg1JyYfD90TS5jl2+0I4va/I=; b=l3gPiAbR7TwGYN3UGjk+XhQ5yIPe9VzuCcThZVxhR0I+4GEnhB8XwKknceAc61+UEi 6Jph9YKpdUFZbTgm3pfaiv2jG+MUlbToxWZWswPFkq7NL+Zvmg5C6MrYmZzQnu2C1Pow N7eW1upCCVnlsgbZ9D9bayg7eTicPMmTVCVFMpdwpAR9KiYBe4qaNxo8VK09og/0AA33 ESG/3Fld16FRUbiXIbOuHn8SDkSRv5EqkDwQU1rWdMNfAgv9yZuvtVf7yAzlhHRNCFNI y1aH3e62gVLa0KqacP5qvyOQU6VwDj2v+EH1MWDocWTQSyvdbNiCIYmf1TVyUjpiJpJb SHDg== 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:mime-version :content-transfer-encoding; bh=GxDy29POy0wkxLFsYTGkg1JyYfD90TS5jl2+0I4va/I=; b=o/TNW29+4EP9uQGmP5N8DULRK5tJmvWRcBwhoTc4/GWYfEgH0f2hElO2jSIhMAli2p H7ZwfzCkld9PsBjn/9uwBFiCtUXKoS+jSZGZ5QEm7/5g1MacPOlO0vX5vNwKvP/4/rH1 rSBgpJRJ8+vGUPOghgCks37bmMfwdmMUBhwbLXWYg2zQ/rznhBVUXDf+Su1w6mV3ivHs eRtzYFLd98Nnr1VXqoFIoH0P6HaZbnlWk9L926+WWUu/e8xBdpxknbe2DprcT4HdMaNe qB5kNIZt3bbfb9qYMLtE9IcOQDqphWZL03eQz4GS/00Bx6hbRT8NDg0UhwdScpDy4FSS eadw== X-Gm-Message-State: AOAM531Bx+xOzI10JE7UwgfrcSh1/MzVns9uhT5dLQGku2raqHenv0cu EAK6amYIbItgO/BvziUJIyU= X-Google-Smtp-Source: ABdhPJz0yeDv0xEEmR6495F6hhD7Vg6Nwbwr1A/Vr6s8nM84K/M7Q4eZX+X0jtsor/40G1QK/FgEOA== X-Received: by 2002:a17:906:19cc:: with SMTP id h12mr167940ejd.386.1627487776939; Wed, 28 Jul 2021 08:56:16 -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 cr9sm73720edb.17.2021.07.28.08.56.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Jul 2021 08:56:16 -0700 (PDT) From: Bin Meng To: Jagan Teki , Vignesh Raghavendra , Pratyush Yadav , u-boot@lists.denx.de Subject: [RFC PATCH] mtd: spi-nor-core: Handle SPI_RX_SLOW in spi_nor_adjust_hwcaps() Date: Wed, 28 Jul 2021 23:56:06 +0800 Message-Id: <20210728155606.554431-1-bmeng.cn@gmail.com> X-Mailer: git-send-email 2.25.1 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 When CONFIG_SPI_FLASH_SMART_HWCAPS is on, SPI_RX_SLOW flag of the SPI controller is not honored. This adds the missing logic there. With this patch, SPI flash read works again with ICH SPI controller on Intel Crown Bay board. Signed-off-by: Bin Meng --- The quirky stuff of ICH SPI controller is that it only supports normal read (opcode 3) but not fast read (opcode 11), so that's why SPI_RX_SLOW was introduced before. At present the ICH SPI driver does not implement the supports_op() hook. I can add a check against opcode 11 there, however I see a comment in spi_nor_check_op() saying that SPI controller implementation should not check the opcode. /* * First test with 4 address bytes. The opcode itself might be a 3B * addressing opcode but we don't care, because SPI controller * implementation should not check the opcode, but just the sequence. */ drivers/mtd/spi/spi-nor-core.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c index 99e2f16349..e9b46c39b5 100644 --- a/drivers/mtd/spi/spi-nor-core.c +++ b/drivers/mtd/spi/spi-nor-core.c @@ -2855,6 +2855,7 @@ spi_nor_adjust_hwcaps(struct spi_nor *nor, const struct spi_nor_flash_parameter *params, u32 *hwcaps) { + struct spi_slave *spi = nor->spi; unsigned int cap; /* @@ -2879,6 +2880,10 @@ spi_nor_adjust_hwcaps(struct spi_nor *nor, if (!(*hwcaps & BIT(cap))) continue; + if ((spi->mode & SPI_RX_SLOW) && + (BIT(cap) == SNOR_HWCAPS_READ_FAST)) + *hwcaps &= ~BIT(cap); + rdidx = spi_nor_hwcaps_read2cmd(BIT(cap)); if (rdidx >= 0 && spi_nor_check_readop(nor, ¶ms->reads[rdidx])) -- 2.25.1