Message ID | 20230714-spi-nor-winbond-w25q128-v3-1-bdb2192f079b@linaro.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp2689946vqm; Fri, 14 Jul 2023 11:49:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlHDslMioH4c1Dd10Jtm+Gk1BGepy76pC7V9wFTT+e0LnfdNtTOPxK4BgMcCaOH2DAMJ+4pw X-Received: by 2002:a05:6402:60a:b0:51d:7fa6:62ca with SMTP id n10-20020a056402060a00b0051d7fa662camr4886915edv.14.1689360548085; Fri, 14 Jul 2023 11:49:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689360548; cv=none; d=google.com; s=arc-20160816; b=epT/zM8ysvmesMnDSloO/fdInKh6zi98g6/Rsd0g3ZV90ryiHECCE7C98rXZ9l0Amm 5ujUtIFQdo30g7KkABKNp4EoOjPqfGgnIECCbtF66U7qJ8O0NnY/rbd+bta0xtAurv5n OzagU2wKAUA8S/WBS0Dmmr0AKBrT3jvPeeZY5qxVdcAVNJJ4ln9JAlLO21jnmtglcPrk MxJtmxGlu0h616OLCtmu8bEY++GW70TBLmqR6ybLMiV6qR8oDEQi6AUkOrtVQl1LYHwt g347eQlk2E6sxpzUpP/YEsB7W2i9yjRLQlHzx/zmRYaN0gc0B09TU6FNWkJBdCGzftFb 2mIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:content-transfer-encoding :mime-version:subject:date:from:dkim-signature; bh=V8Wt8cMGCqy9CZq6012XBPM2kyz2Mn90yzkk5uGQWyU=; fh=pm4Kai/562l+lZAJZUDmzyuHZ6dwQLU6qQzAPkVpbOI=; b=guT0SGqWN1fppjoiCUbCHZCcO6inBwPtdgSCpzzF0oOtXNX7eK+RK4Ee+hqEYmnwOS pRfoFs/cqJGg/vWLEjvC3GoeLTZVPAWL5pKmqd2Jvp1eUSjM9JL8uEBTbewL6qQNQG06 B+VuIDHc0iGgRI6nIjAEgO5/gHl+BZYz8SIETf0y70dOn10D20q3KZn2e3K+FsKC9oQW rDWgO+45FZMAmrbuDg0cknsxtxMxjk4g0JvJ3KxUqd9fof11qxWOaMGKP0xJTe2HDDJP aQ8/YrvTCyQ1xQa4L5R/mX9C7RUPmZM1Y3Z86CQfD8dt8CCQGL+OL4ch/obNVlylsasD YuVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mvajMGQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f3-20020a05640214c300b0051e23edcddcsi9409364edx.122.2023.07.14.11.48.44; Fri, 14 Jul 2023 11:49:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=mvajMGQN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236845AbjGNS3M (ORCPT <rfc822;hadasmailinglist@gmail.com> + 99 others); Fri, 14 Jul 2023 14:29:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43586 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236842AbjGNS3J (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 14 Jul 2023 14:29:09 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3199626BB for <linux-kernel@vger.kernel.org>; Fri, 14 Jul 2023 11:29:07 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b6fbf0c0e2so34252101fa.2 for <linux-kernel@vger.kernel.org>; Fri, 14 Jul 2023 11:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1689359345; x=1691951345; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:from:to:cc:subject:date:message-id:reply-to; bh=V8Wt8cMGCqy9CZq6012XBPM2kyz2Mn90yzkk5uGQWyU=; b=mvajMGQNG+5AvAaKOl4BVvuCD4zs13l7V8u70iG64R7IMoL+YUkkqskXvWa83uZY/G tU2iLxRoo/usmgBwqJQk4hnIuumPHp19LW+BiipO4d1rxi2u/CW7DEk8Yt9q13RhReES 2p//ZDhe8aHwjamAXl7mWylHty+53enF4TOZDB36PCmCe8ivLlh7OtkCMjTN7rzH+Gbm YDFDQWE4OvKL1PwI3DpuPkZDOYfDT9tMiURUd6t+IOFsBp7ANcagPRbr84Wtyp46RDXV jtSrCA7MfuO5SyUHaqx/HwpKeFeC69gB1NJpbjhEI6uEEppjTmShQZkt5zvClfZNim9b zbdQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689359345; x=1691951345; h=cc:to:message-id:content-transfer-encoding:mime-version:subject :date:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=V8Wt8cMGCqy9CZq6012XBPM2kyz2Mn90yzkk5uGQWyU=; b=e5OBuLjgXuC+CW1HwsX1iToYClNvyDUzQcJ7YyNNef9vJRigh9QlblVV//nKrN7Nz2 meJvsakQItrjwtT1LXaRwQN9bM0DZZcR7P/htBjcGJXosT6vEk9+BRW4GG7GupV1xuHg EHah9SM54dVO7oYVnYikn6ayhM6VBHmXDttYAxnBUdcFhWwq2qMdVIWY41bynDYufyyE fhFNerm8gL7JkPkpnH1lnithuPqAa91bzp4NAZTbJFMnLikQNvWSjGJhrL+5Ia+Okaor 1ItWDdxYu4Fa/4gYLpC7bjVe34VUfK1SXJOGBeZuYkJXEQjDEOV7AKPnnyARFB9imgBN 9qBA== X-Gm-Message-State: ABy/qLYIulcgLuR79DqxWeFMvXVpmeYDmURd7JXk5LE4gg6dDUm5ozFs O6R8wHLFAouiIsLZUPalHjxMFw== X-Received: by 2002:a2e:9c93:0:b0:2b6:e536:a2a9 with SMTP id x19-20020a2e9c93000000b002b6e536a2a9mr4728029lji.47.1689359345403; Fri, 14 Jul 2023 11:29:05 -0700 (PDT) Received: from [127.0.1.1] ([85.235.12.238]) by smtp.gmail.com with ESMTPSA id f21-20020a2e9e95000000b002b1b92910c8sm2092229ljk.86.2023.07.14.11.29.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jul 2023 11:29:05 -0700 (PDT) From: Linus Walleij <linus.walleij@linaro.org> Date: Fri, 14 Jul 2023 20:29:03 +0200 Subject: [PATCH v3] mtd: spi-nor: Correct flags for Winbond w25q128 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20230714-spi-nor-winbond-w25q128-v3-1-bdb2192f079b@linaro.org> X-B4-Tracking: v=1; b=H4sIAO6TsWQC/43NTQrCMBCG4auUrI1kJvZHV95DXKRN0g5IUhNJl dK7mxZcuBBcvh/MMzOLJpCJ7FTMLJhEkbzLIXcF6wblesNJ52YoUIoagMeRuPOBT+Ra7zSfsLw DNlwiqEqgMVjVLF+PwVh6bvLlmnug+PDhtT1KsK4fE3+aCThwWzdWtu0BFXTnGzkV/N6Hnq1ow j8hzFApuqMFXTa6+oaWZXkD23C8bggBAAA= To: Tudor Ambarus <tudor.ambarus@linaro.org>, Pratyush Yadav <pratyush@kernel.org>, Michael Walle <michael@walle.cc>, Miquel Raynal <miquel.raynal@bootlin.com>, Richard Weinberger <richard@nod.at>, Vignesh Raghavendra <vigneshr@ti.com> Cc: linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Linus Walleij <linus.walleij@linaro.org> X-Mailer: b4 0.12.3 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771422925872831901 X-GMAIL-MSGID: 1771422925872831901 |
Series |
[v3] mtd: spi-nor: Correct flags for Winbond w25q128
|
|
Commit Message
Linus Walleij
July 14, 2023, 6:29 p.m. UTC
The Winbond "w25q128" (actual vendor name W25Q128JV) has
exactly the same flags as the sibling device "w25q128jv".
The devices both require unlocking to enable write access.
The actual product naming between devices vs the Linux
strings in winbond.c:
0xef4018: "w25q128" W25Q128JV-IM/JM
0xef7018: "w25q128jv" W25Q128JV-IN/IQ/JQ
The latter device, "w25q128jv" supports features named DTQ
and QPI, otherwise it is the same.
Not having the right flags has the annoying side effect
that write access does not work.
After this patch I can write to the flash on the Inteno
XG6846 router.
The flash memory also supports dual and quad SPI modes.
This does not currently manifest, but by turning on SFDP
parsing, the right SPI modes are emitted in
/sys/kernel/debug/spi-nor/spi1.0/capabilities
for this chip, so we also turn on this.
Since we suspect that older chips may be using the same
device ID, we need to keep NO_SFDP_FLAGS(SECT_4K) as these
older chips may not support SFDP.
cat jedec_id
ef4018
cat manufacturer
winbond
cat partname
w25q128
hexdump -v -C sfdp
00000000 53 46 44 50 05 01 00 ff 00 05 01 10 80 00 00 ff
00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000040 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
00000080 e5 20 f9 ff ff ff ff 07 44 eb 08 6b 08 3b 42 bb
00000090 fe ff ff ff ff ff 00 00 ff ff 40 eb 0c 20 0f 52
000000a0 10 d8 00 00 36 02 a6 00 82 ea 14 c9 e9 63 76 33
000000b0 7a 75 7a 75 f7 a2 d5 5c 19 f7 4d ff e9 30 f8 80
Cc: stable@vger.kernel.org
Suggested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Changes in v3:
- Keep NO_SFDP_FLAGS(SECT_4K) around.
- Update commit message
- Link to v2: https://lore.kernel.org/r/20230712-spi-nor-winbond-w25q128-v2-1-50c9f1d58d6c@linaro.org
Changes in v2:
- Only add the write access flags.
- Use SFDP parsing to properly detect the various
available SPI modes.
- Link to v1: https://lore.kernel.org/r/20230712-spi-nor-winbond-w25q128-v1-1-f78f3bb42a1c@linaro.org
---
drivers/mtd/spi-nor/winbond.c | 2 ++
1 file changed, 2 insertions(+)
---
base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5
change-id: 20230711-spi-nor-winbond-w25q128-321a602ee267
Best regards,
Comments
Hi, Am 2023-07-14 20:29, schrieb Linus Walleij: > The Winbond "w25q128" (actual vendor name W25Q128JV) has > exactly the same flags as the sibling device "w25q128jv". > The devices both require unlocking to enable write access. > > The actual product naming between devices vs the Linux > strings in winbond.c: > > 0xef4018: "w25q128" W25Q128JV-IM/JM > 0xef7018: "w25q128jv" W25Q128JV-IN/IQ/JQ This is still wrong btw. According to: https://www.winbond.com/resource-files/W25Q128JV%20RevI%2008232021%20Plus.pdf This should be 0xef4018: "w25q128" W25Q128JV-IN/IQ/JQ 0xef7018: "w25q128jv" W25Q128JV-IM/JM Otherwise, looks good. Either Tudor can change that in place while picking up the patch or you could send a new version. Either way: Reviewed-by: Michael Walle <michael@walle.cc> Thanks! -michael > The latter device, "w25q128jv" supports features named DTQ > and QPI, otherwise it is the same. > > Not having the right flags has the annoying side effect > that write access does not work. > > After this patch I can write to the flash on the Inteno > XG6846 router. > > The flash memory also supports dual and quad SPI modes. > This does not currently manifest, but by turning on SFDP > parsing, the right SPI modes are emitted in > /sys/kernel/debug/spi-nor/spi1.0/capabilities > for this chip, so we also turn on this. > > Since we suspect that older chips may be using the same > device ID, we need to keep NO_SFDP_FLAGS(SECT_4K) as these > older chips may not support SFDP. > > cat jedec_id > ef4018 > cat manufacturer > winbond > cat partname > w25q128 > hexdump -v -C sfdp > 00000000 53 46 44 50 05 01 00 ff 00 05 01 10 80 00 00 ff > 00000010 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000020 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000030 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000040 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000050 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000060 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000070 ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff > 00000080 e5 20 f9 ff ff ff ff 07 44 eb 08 6b 08 3b 42 bb > 00000090 fe ff ff ff ff ff 00 00 ff ff 40 eb 0c 20 0f 52 > 000000a0 10 d8 00 00 36 02 a6 00 82 ea 14 c9 e9 63 76 33 > 000000b0 7a 75 7a 75 f7 a2 d5 5c 19 f7 4d ff e9 30 f8 80 > > Cc: stable@vger.kernel.org > Suggested-by: Michael Walle <michael@walle.cc> > Signed-off-by: Linus Walleij <linus.walleij@linaro.org> > --- > Changes in v3: > - Keep NO_SFDP_FLAGS(SECT_4K) around. > - Update commit message > - Link to v2: > https://lore.kernel.org/r/20230712-spi-nor-winbond-w25q128-v2-1-50c9f1d58d6c@linaro.org > > Changes in v2: > - Only add the write access flags. > - Use SFDP parsing to properly detect the various > available SPI modes. > - Link to v1: > https://lore.kernel.org/r/20230712-spi-nor-winbond-w25q128-v1-1-f78f3bb42a1c@linaro.org > --- > drivers/mtd/spi-nor/winbond.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/mtd/spi-nor/winbond.c > b/drivers/mtd/spi-nor/winbond.c > index 834d6ba5ce70..8f30a67cd27a 100644 > --- a/drivers/mtd/spi-nor/winbond.c > +++ b/drivers/mtd/spi-nor/winbond.c > @@ -121,6 +121,8 @@ static const struct flash_info winbond_nor_parts[] > = { > { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16) > NO_SFDP_FLAGS(SECT_4K) }, > { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256) > + PARSE_SFDP > + FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) > NO_SFDP_FLAGS(SECT_4K) }, > { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512) > NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) > > --- > base-commit: 06c2afb862f9da8dc5efa4b6076a0e48c3fbaaa5 > change-id: 20230711-spi-nor-winbond-w25q128-321a602ee267 > > Best regards,
On Fri, Jul 14, 2023 at 9:30 PM Michael Walle <michael@walle.cc> wrote: > Am 2023-07-14 20:29, schrieb Linus Walleij: > > The Winbond "w25q128" (actual vendor name W25Q128JV) has > > exactly the same flags as the sibling device "w25q128jv". > > The devices both require unlocking to enable write access. > > > > The actual product naming between devices vs the Linux > > strings in winbond.c: > > > > 0xef4018: "w25q128" W25Q128JV-IM/JM > > 0xef7018: "w25q128jv" W25Q128JV-IN/IQ/JQ > > This is still wrong btw. According to: > https://www.winbond.com/resource-files/W25Q128JV%20RevI%2008232021%20Plus.pdf > > This should be > 0xef4018: "w25q128" W25Q128JV-IN/IQ/JQ > 0xef7018: "w25q128jv" W25Q128JV-IM/JM > > Otherwise, looks good. Either Tudor can change that in > place while picking up the patch or you could send a new > version. Ooops you're right, I'll just pick up your tag and re-send, sorry! Yours, Linus Walleij
diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index 834d6ba5ce70..8f30a67cd27a 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -121,6 +121,8 @@ static const struct flash_info winbond_nor_parts[] = { { "w25q80bl", INFO(0xef4014, 0, 64 * 1024, 16) NO_SFDP_FLAGS(SECT_4K) }, { "w25q128", INFO(0xef4018, 0, 64 * 1024, 256) + PARSE_SFDP + FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) NO_SFDP_FLAGS(SECT_4K) }, { "w25q256", INFO(0xef4019, 0, 64 * 1024, 512) NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)