Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2381706pxp; Mon, 7 Mar 2022 14:18:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy3JM2Q2r1/umUVxTq8cUHDncXTVYSmfKQvKcp8KofltdGrzyiepWR2p1LfkcxUqAQLdRog X-Received: by 2002:a17:903:230f:b0:151:e465:1877 with SMTP id d15-20020a170903230f00b00151e4651877mr8494700plh.19.1646691491624; Mon, 07 Mar 2022 14:18:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646691491; cv=none; d=google.com; s=arc-20160816; b=R49CAgejTVky0UrHwwwexwduO3T9aO+T+w7L183wato1jfdVgF8fkiG1+XE4t7jM2G hAL8J+qLHrCWYe43uPlOIZByo1jzAoDjrfQzkNHfJL8I7vebi/IsEuA7dBtdsc7qmlC5 6hF3wJkv2yQktoIZRQHOk73ZrdofyDLYHzH2fLvAR8eqUv3Rnmnq0o70AGn6B+Y0FxWu sa9AQIm2ctcTymvKi/B9cigknbAuy8gPHwn3DoyO6lVBmizub+IaxzJp+R9X2od5iQuy s9NDQUkdcN0jXOrHK5w0bAIBunJ+VCYC+SugTIB+kRN9ANcT5U6h8wQ0N5T6VfZFyFPs GU+g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=jynvMdOjVlgIcz22WDLr8fvdTgkc/bKXr6LbivyuED4=; b=Uxa36XQM0RZ0awLJIAMYpr4xJumueT/jTMrS+k83JQELqpwNTleXJSaNQpVUfdAw71 XMUwwxteYew3pCup10ietYFIo/BXfo4559ffPcQGk39dFDNyv1dVPVilW4PSkMp08Z4D dFSQyxcljaDVENNVr7edYhB688Q01mJLhfeal52cZegaX5WoTe/3uAKy+qw/SiCnQ49A VgxzyE/qNUhFV4L8yCJaAXNPoPsjraQSlOGufeN8ZZdUqdo5UiwxRsIDTBfZANkUjvr9 t8jEspMqDQeawQS5FQKQuc2jCioZCE5MnCF7l53Kb5npZRc7eJJa69yhxjijD44rHKkb 8UMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b=vTQ0XovI; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s68-20020a632c47000000b0037c5bd90bdesi12911956pgs.5.2022.03.07.14.17.54; Mon, 07 Mar 2022 14:18:11 -0800 (PST) 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=@walle.cc header.s=mail2016061301 header.b=vTQ0XovI; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236299AbiCGS6A (ORCPT + 99 others); Mon, 7 Mar 2022 13:58:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244848AbiCGS5q (ORCPT ); Mon, 7 Mar 2022 13:57:46 -0500 Received: from ssl.serverraum.org (ssl.serverraum.org [IPv6:2a01:4f8:151:8464::1:2]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFD2292D0E for ; Mon, 7 Mar 2022 10:56:51 -0800 (PST) Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 6E2812223A; Mon, 7 Mar 2022 19:56:48 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1646679408; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=jynvMdOjVlgIcz22WDLr8fvdTgkc/bKXr6LbivyuED4=; b=vTQ0XovIyiQumIN7uhXJjFwNCBoyivvrbaDyTk3gJthGdsbROQT927Em7CVFOuQVuBsgIt 4dhmRp1AtvhBe7NDq9+8LJ2WACD8eK1Wjrb85DAVU0Y7weUjlz/cSp88Cf8FYin+9+q/HM S65yPk5N+6nGtVh4wEIUONSvrYCg1Co= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 07 Mar 2022 19:56:48 +0100 From: Michael Walle To: Tudor.Ambarus@microchip.com Cc: p.yadav@ti.com, miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, heiko.thiery@gmail.com Subject: Re: [PATCH v1] mtd: spi-nor: unset quad_enable if SFDP doesn't specify it In-Reply-To: <92cde38c-d398-44f4-26f8-ef4919f5944e@microchip.com> References: <20220304185137.3376011-1-michael@walle.cc> <7f339d0c-5ca9-261c-a545-d4ebf3bda140@microchip.com> <92cde38c-d398-44f4-26f8-ef4919f5944e@microchip.com> User-Agent: Roundcube Webmail/1.4.12 Message-ID: <7f947928e7189f98eb950828990b3920@walle.cc> X-Sender: michael@walle.cc X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org Am 2022-03-07 10:23, schrieb Tudor.Ambarus@microchip.com: > On 3/7/22 09:12, Tudor.Ambarus@microchip.com wrote: >> EXTERNAL EMAIL: Do not click links or open attachments unless you know >> the content is safe >> >> On 3/4/22 20:51, Michael Walle wrote: >>> EXTERNAL EMAIL: Do not click links or open attachments unless you >>> know the content is safe >>> >>> While the first version of JESD216 specify the opcode for 4 bit I/O >>> accesses, it lacks information on how to actually enable this mode. >>> >>> For now, the one set in spi_nor_init_default_params() will be used. >>> But this one is likely wrong for some flashes, in particular the >>> Macronix MX25L12835F. Thus we need to clear the enable method when >>> parsing the SFDP. Flashes with such an SFDP revision will have to use >>> a >>> flash (and SFDP revision) specific fixup. >>> >>> This might break quad I/O for some flashes which relied on the >>> spi_nor_sr2_bit1_quad_enable() that was formerly set. If your bisect >>> turns up this commit, you'll probably have to set the proper >>> quad_enable method in a post_bfpt() fixup for your flash. >>> >> >> Right, I meant adding a paragraph such as the one from above. >> >>> Signed-off-by: Michael Walle >>> Tested-by: Heiko Thiery >>> --- >>> changes since RFC: >>> - reworded commit message >>> - added comment about post_bfpt hook >>> >>> Tudor, I'm not sure what you meant with >>> Maybe you can update the commit message and explain why would some >>> flashes fail to enable quad mode, similar to what I did. >>> >>> It doesn't work because the wrong method is chosen? ;) >>> >>> drivers/mtd/spi-nor/sfdp.c | 11 ++++++++++- >>> 1 file changed, 10 insertions(+), 1 deletion(-) >>> >>> diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c >>> index a5211543d30d..6bba9b601846 100644 >>> --- a/drivers/mtd/spi-nor/sfdp.c >>> +++ b/drivers/mtd/spi-nor/sfdp.c >>> @@ -549,6 +549,16 @@ static int spi_nor_parse_bfpt(struct spi_nor >>> *nor, >>> map->uniform_erase_type = map->uniform_region.offset & >>> SNOR_ERASE_TYPE_MASK; >>> >>> + /* >>> + * The first JESD216 revision doesn't specify a method to >>> enable >>> + * quad mode. spi_nor_init_default_params() will set a legacy >>> + * default method to enable quad mode. We have to disable it >>> + * again. >>> + * Flashes with this JESD216 revision need to set the >>> quad_enable >>> + * method in their post_bfpt() fixup if they want to use quad >>> I/O. >>> + */ >> >> Great. Looks good to me. I'll change the subject to "mtd: spi-nor: >> sfdp:" >> when applying. > > As we talked on the meeting, we can instead move the default quad mode > init > to the deprecated way of initializing the params, or/and to where > SKIP_SFDP > is used. This way you'll no longer need to clear it here. Mh, I just had a look and I'm not sure it will work there, because in the deprecated way, the SFDP is still parsed and thus we might still have the wrong enable method for flashes which don't have PARSE_SFDP set. -michael