Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp113731pxb; Thu, 14 Apr 2022 17:27:48 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhhW4O9KXHJ4hGRzoQ4D9Pskkj4d+KbjKiUt6w7PnwrW5g6fqO7XeSHRpruJFh29Iw76jC X-Received: by 2002:a17:902:cec1:b0:158:85e5:4c6b with SMTP id d1-20020a170902cec100b0015885e54c6bmr15752938plg.12.1649982467900; Thu, 14 Apr 2022 17:27:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649982467; cv=none; d=google.com; s=arc-20160816; b=PTpDGPS7QbsnH9Bay2Og+mmAQKuM5uPNkURTXVWoXChOGt/J622xtwGOT0qAjLXOfp QL4PEibqUIobrqSDdRqB+M85briErX5TYNZ81UWGaymC1+qeDQieUjS1+6h7mNMykNrA CL6a9wXTiDOw2W+7KGoXGsFG9PckEokEhZV1qzZNmcXrCS+yiMwIRhwH9U2mB6ZkvY1H ZVChZpZr/OrvdLEeHt00iPQDKcO038/hJEyKTlfKwyIgcTu2vbsUkYypXZbZY5fzgzvL MgMIUzCaXK6ScscWxlh5dQOvWc5CpAfPXhepbC+NQUrCH15gYAPzd/gn/P8UNdYMCWFf 8zVw== 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=YYsTz0AETw+Jo2bhSTzYcAAeYKfM5N1Ra7bU1357urA=; b=WPfZ1QLfD8Ag8n1yTdYOE6U3d0+4E+NzOnGx74OIhYy+P4QdOQvYslGywGGCA1e0cO /VImhfUs7ELjT8UGsmDTsKA30Fy1i23owfEXdEnqxOlHzX+vQeDVnyFVcLcev9Xbck+Q ijgff+469qCaw9QmSFzQmEs11X+B6rs5QyHXZJP+JPKdjUrf25Vml5GYqmSvWsTqPoLd VmtpRg6egLibl7C4tVwzBqv6eJuoziQy4GaFwbflu3ORn9GFWTwjODVeANHBpdkUP5Cx OYvPdH6+ZjU1YD5iSUq9Wyxhc26SDJGQ+3sthFvY0d6dNYcFMbXbXZ8zbLWN5LGzw4CI o+Hw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="ir4wCF/1"; 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 t14-20020a170902e84e00b001584ee3ba07si16435190plg.439.2022.04.14.17.27.22; Thu, 14 Apr 2022 17:27:47 -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=@walle.cc header.s=mail2016061301 header.b="ir4wCF/1"; 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 S241601AbiDNJGe (ORCPT + 99 others); Thu, 14 Apr 2022 05:06:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241572AbiDNJGV (ORCPT ); Thu, 14 Apr 2022 05:06:21 -0400 Received: from ssl.serverraum.org (ssl.serverraum.org [176.9.125.105]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1733071EE2 for ; Thu, 14 Apr 2022 02:03:23 -0700 (PDT) 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 A91842223A; Thu, 14 Apr 2022 11:03:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1649927002; 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=YYsTz0AETw+Jo2bhSTzYcAAeYKfM5N1Ra7bU1357urA=; b=ir4wCF/1KUj3+6aRDS/Z9w9E9Myrb626mUSIqpljXMGuPyGvI205vKqwMP9CNQT0UrkXEg AqIiDztJ9r468vj0L87nk3qRtJ/QYTbJDBy+ScwLT6J5fXuF2zyo9ZOqzdTqh9WXJ7Cu9H ORqyhvHLkEjeE04v2r4mMCaLOWr0uYs= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Thu, 14 Apr 2022 11:03:21 +0200 From: Michael Walle To: Tudor Ambarus 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, nicolas.ferre@microchip.com Subject: Re: [PATCH v3 1/3] mtd: spi-nor: Parse BFPT to determine the 4-Byte Address Mode methods In-Reply-To: <20220411125346.118274-2-tudor.ambarus@microchip.com> References: <20220411125346.118274-1-tudor.ambarus@microchip.com> <20220411125346.118274-2-tudor.ambarus@microchip.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <63b485a1e48d3116f8f49cc427049f81@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 > diff --git a/drivers/mtd/spi-nor/sfdp.c b/drivers/mtd/spi-nor/sfdp.c > index a5211543d30d..2e40eba3744d 100644 > --- a/drivers/mtd/spi-nor/sfdp.c > +++ b/drivers/mtd/spi-nor/sfdp.c > @@ -401,6 +401,93 @@ static void > spi_nor_regions_sort_erase_types(struct spi_nor_erase_map *map) > } > } > > +/** > + * spansion_set_4byte_addr_mode() - Set 4-byte address mode for > Spansion > + * flashes. > + * @nor: pointer to 'struct spi_nor'. > + * @enable: true to enter the 4-byte address mode, false to exit the > 4-byte > + * address mode. > + * > + * Return: 0 on success, -errno otherwise. > + */ > +int spansion_set_4byte_addr_mode(struct spi_nor *nor, bool enable) Mh, so now some callback functions are in the core like the quad enable methods and some are in sfdp.c. I think there should be only the parsing in sfdp.c and all the callback methods should be in core.c; as they are potentially used by the vendor modules. > @@ -606,6 +693,24 @@ static int spi_nor_parse_bfpt(struct spi_nor *nor, > break; > } > > + switch (bfpt.dwords[BFPT_DWORD(16)] & BFPT_DWORD16_4B_ADDR_MODE_MASK) > { I was wondering why this is encoded as single bits and not as an enumeration. To me it looks like it is intended to support different methods at the same time. Thus I think there might be multiple bits set in each entry and exit mask at once. The spec lists all the entries as x_xxx1, x_xx1x, .. > + case BFPT_DWORD16_4B_ADDR_MODE_BRWR: .. then this will only match if exactly these two bits are set. > + params->set_4byte_addr_mode = spansion_set_4byte_addr_mode; Shouldn't this be getting a neutral name? The quad_enable methods were renamed once, too. -michael