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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id AA16BC433FE for ; Wed, 16 Mar 2022 10:07:18 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0D81982155; Wed, 16 Mar 2022 11:07:16 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1647425236; bh=TBV4a5CWKvsynn/ZWK2wv+NWLAbwGBRT8qjPAN8N+6w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TFMjfU8lIfUKiGF0nVJ0fUtPMr6dXkWLSW2TUy8k5R9+ojvBgN3hDdhNTp+s/QOzx d8k3o19wx0cIgb+YQRUv2fKoslBd8dOEFwuk3hi2EXrDsRiEhEKRdktIkJ/ci9dwfJ wo4D5SttvwAk7IUoUDol+G7jKLNU43c3jTKU7kG6wrBKkHuiu77LfWLlX75j+37rdP gz93/VdCH5DH4M21gMC+e/LDWWUdIDz8MwP9IemvnmgyboULlwC7LSYFzKlQlq1JPn lNJl/NUHuAjC2H1u8qx/Vx0Q+8tS6QhCWpsSTUsCqftUIqXwZi7numbeNK2nmTyjt4 d0ncmDP6qDNcQ== Received: from [127.0.0.1] (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 9973680288; Wed, 16 Mar 2022 11:07:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1647425233; bh=TBV4a5CWKvsynn/ZWK2wv+NWLAbwGBRT8qjPAN8N+6w=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=oRjHse4NttzbiFwFk93+9JTCHhoiDWtsL2y8pmsF0Gy30TWKtWQ5Zp5mBpHSdmZZf WjJ9x+tYxLPPh9oYac/2fnuzDMgsK/QpQVKIJE4Qu5vnbHnrTH39og92pLs+uk9Vtw 2haA3WliDq98qXMhN4jtCnIuQ69v3Hb6Ks/yAf+7wUsvYjFkX6LtPuOIhYgsn08woT TCxN0n1UGt3dhPNC4JYvHUFodtkihfY2KDZtSxKukGSowa7HGHkZE4bei7Pz6b+NyV fVQMsHC7SA6CCcWRtLkCqFoA2vpVTsXtwPWgRB+NEIwoVzNodCNSs4l2qjscB8TMx8 hMhz2PZi+AqqQ== Message-ID: <7b37cde0-9189-613c-3769-9162db7df851@denx.de> Date: Wed, 16 Mar 2022 11:07:11 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.2 Subject: Re: [PATCH] mtd: spi-nor-ids: Add Winbond W25Q128JW ID Content-Language: en-US To: Tudor.Ambarus@microchip.com, u-boot@lists.denx.de Cc: Horatiu.Vultur@microchip.com, jagan@amarulasolutions.com, simon.k.r.goldschmidt@gmail.com, sr@denx.de, vigneshr@ti.com, michael@walle.cc References: <20220309031826.134803-1-marex@denx.de> <978ae9ee-f51b-c89f-36c8-329153f4d51c@denx.de> <465a5305-2afb-8f22-7fd6-9d3baf31cd22@microchip.com> From: Marek Vasut In-Reply-To: <465a5305-2afb-8f22-7fd6-9d3baf31cd22@microchip.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean On 3/16/22 04:55, Tudor.Ambarus@microchip.com wrote: Hi, >> [...] >> >>>>   drivers/mtd/spi/spi-nor-ids.c | 5 +++++ >>>>   1 file changed, 5 insertions(+) >>>> >>>> diff --git a/drivers/mtd/spi/spi-nor-ids.c b/drivers/mtd/spi/spi-nor-ids.c >>>> index b551ebd75ef..e2d09fc747d 100644 >>>> --- a/drivers/mtd/spi/spi-nor-ids.c >>>> +++ b/drivers/mtd/spi/spi-nor-ids.c >>>> @@ -345,6 +345,11 @@ const struct flash_info spi_nor_ids[] = { >>>>                          SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ | >>>>                          SPI_NOR_HAS_LOCK | SPI_NOR_HAS_TB) >>>>          }, >>>> +       { >>>> +               INFO("w25q128jw", 0xef8018, 0, 64 * 1024, 256, >>> >>> I'm glad I can discuss with you about the name of these winbond flashes, >>> you can help with an advice. In linux we name this flash "w25q128jwm", >>> but maybe we should change it. >> >> How did you arrive at "jwm" suffix ? Per both [1] and [2] "11.1 Valid > > by checking sections "8.1.1 Manufacturer and Device Identification" and > "11. ORDERING INFORMATION" from the datasheets. > > Package type and temperature info doesn't matter for naming convention, > but seems that the last suffix does: when M, QE = 0 (and it is programmable), > when Q or N, Quad Enable is fixed and always enabled (QE = 1). Oh, so that would be w25q128jw--m / w25q128jw--q then ? >> Part Numbers and Top Side Marking" there is no "M" PACKAGE TYPE, so that >> seems wrong. > > mm, ok. See above. >>> Winbond names this flash "W25Q128JW_DTR", you can find the name on the >>> top right of each page from [1]. >> >> Per 8.1 the IDs are the same for both _DTR [1] and non-DTR [2] variants. >> >>> What I propose: >>> 1/ according to [1] W25Q128JW_IM/JM is W25Q128JW_DTR, let's use "-dtr" >>>     for the M flavor. >>> 2/ according to [2] W25Q128JW has two flavors: W25Q128JW-IQ/JQ and >>>     W25Q128JW-IM/JM*. Since W25Q128JW_IM/JM is called W25Q128JW_DTR, let's >>>     use just "W25Q128JW" for W25Q128JW-IQ/JQ, as winbond uses too. >> >> 1/ That looks wrong to me. The W25Q128JW and W25Q128JW_DTR are two >> different products of Winbond, see "Features" column in: >> >> https://www.winbond.com/hq/product/code-storage-flash-memory/serial-nor-flash/ >> >> Density -> 128Mb >> >> W25Q128JW >> 1.7V - 1.95V >> 133MHz >> SPI 4 I/O Fixed <------ >> >> W25Q128JW_DTR >> 1.7V - 1.95V >> 133MHz >> SPI / QPI / DTR <------ >> >> Then, compare the datasheets [1] and [2], notice how the _DTR variant >> supports more functionality compared to the non-DTR variant: >> >> 8.1.4 Instruction Set Table 3 (QPI Instructions) >> 8.1.5 Instruction Set Table 4 (DTR with SPI Instructions) >> 8.1.6 Instruction Set Table 5 (DTR with QPI Instructions) >> >> So my counter-proposal would be to call it just "w25q128jw" , that's the >> lowest common denominator of the DTR and non-DTR variant. And then, use >> SFDP to determine whether the QPI/DTR extras are supported by the flash >> (and thus whether it is the DTR variant or not). >> >> The only downside is, I only have the non-DTR variant, so I cannot dump >> the SFDP tables of the DTR variant and check whether it differs from the >> non-DTR variant. I would expect it does. >> >> 2/ That looks wrong to me too. Look at [1] for the meaning of -xM/-xQ >> suffix of the flash, it has nothing to do with the DTR support. It just >> says what is the QE bit setting in SR2: >> >> 11. ORDERING INFORMATION >> Q ... with QE = 1 (fixed) in Status register-2. >> N ... with QE = 1 (fixed) in Status register-2 & DRV=75%. Backward >> compatible to FW family. >> M ... with QE = 0 (programmable) in Status register-2. New device ID is >> used to identify FW family >> >>> Looking at [3], I see that W25Q128JV and W25Q128FV use the same flash ID, >>> I wonder what's the difference between them. I made a proposal in linux on >>> how to handle flash collisions, a v5 will follow. >> >> https://www.winbond.com/hq/product/code-storage-flash-memory/serial-nor-flash/ >> >> Density -> 128Mb >> >> W25Q128FV >> 2.7V - 3.6V >> 104MHz <----------- >> SPI / QPI <-------- >> >> W25Q128JV >> 2.7V - 3.6V >> 133MHz <----------- >> SPI 4 I/O Fixed <-- >> >> Unlike the -JV, the -FV has >> Instruction Set Table 3 (QPI Instructions) >> >> See my suggestion above, use the lowest common denominator flash (in >> this case JV) as a base and then use SFDP to determine whether extra >> features are available. Would that work ? > > I don't think it will work because the -DTR and non-DTR have different flash > IDs. Be careful, I think you are conflating -xM/-xQ and _DTR and non-DTR variants of this W25Q128 flash. Look at [1] and [2] again, the ID 0x8018: 8.1.1 Manufacturer and Device Identification Device ID | (ID7 - ID0) | (ID15 - ID0) Instruction | ABh, 90h, 92h, 94h | 9Fh (non-DTR variant) W25Q128JW-IQ/JQ | 17h | 6018h W25Q128JW-IM/JM*| 17h | 8018h -DTR variant: W25Q128JW_IM/JM | 17h | 8018h So you should be able to tell the non-DTR variant of w25q128jw based purely on flash ID . You should also be able to tell whether the 0x8018 flash is in fact DTR variant based on the presence of the extra DTR opcodes in SFDP. This: if (id == 0x6018) { return W25Q128JWxxQ with QE=1 } else if (id == 0x8018) { if (SFDP indicates DTR commands present) return W25Q128JWxxM_DTR; else return W25Q128JWxxM (non-DTR); } Same thing applies to W25Q128JV/FV with id 0x4018: Device ID | (ID7 - ID0) | (ID15 - ID0) Instruction | ABh, 90h, 92h, 94h | 9Fh W25Q128FV (SPI Mode) | 17h | 4018h W25Q128FV (QPI Mode) | 17h | 6018h Device ID | (ID7 - ID0) | (ID15 - ID0) Instruction | ABh, 90h, 92h, 94h | 9Fh W25Q128JV-IN/IQ/JQ | 17h | 4018h W25Q128JV-IM*/JM* | 17h | 7018h There the lowest common denominator is w25q128jv and we should be able to tell whether it is really w25q128fv by checking SFDP and see whether the QPI opcodes are supported. [...]