Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp276176ybk; Thu, 14 May 2020 23:57:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPtJuFwIOheqmtM0uk/MWimhbaF0vn5HGG1hIwCRO2VmqfeVcCs7NmBDQaJmS2vTPXWvRz X-Received: by 2002:a05:6402:319c:: with SMTP id di28mr1522482edb.185.1589525859684; Thu, 14 May 2020 23:57:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589525859; cv=none; d=google.com; s=arc-20160816; b=crd2YTgvKlSr+rCq6ytRVuccy5jN3CSXGuRckI6MHuW4VjZhzt7ydZkPxBpmpZ2JJu fSr1dXDQh0niIVqUoEk3Ilfr0emJKAJj2KLSKGwn84aW4Sf8iZjhhHOM6d2AupECF/7L V3KUUwJsWmhdxvkym7A7jUAAJqo+xMnz3xl3f5leR7q0r0UBBxx/8UrkdnfW59roM8TZ EhSv3w9n46fF+8oO9syZyQ5W28194zdjn+Sxd8o0lzhAqeCYh7KrqwNqX9pZdE5vBr/B QTDpe9mLxEw+D+POwuOHGXDd1D4pdnaQp/K3i307Q351lRXGc/vsiwDvXFfZfmzp5cq4 y4kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=UO1aqA3J74U4vas6X07F9qbvvKoHRUM34tsw0CE/9vk=; b=AnwJ/HZSOwPj7rOOhFqx37qzMDAym0LxHNt/M9NCMWY+BAG9Hb4QnHshzGIx4SLt2p qsWQfHyplzgMdeGJtPwu7pEevMDPfBZaqlwchy7BpJcd/kwafsfHOLsEZ6001IuCpcB7 sorX7uu+Jiwu4LFy/XKFd19aOzbL3BXv46n++v1OnCT07JXBdGZMwINZKaFq9Ddm413W RGElI1QgFiAi+LkCYNlAU3AF11EKNd4FcHh6qQxyeC++SA4Kdx8ZFkuM77ZUdVjdf9D9 PkL0M/JxDsGyonYKaWamEJr/AzFdgdB3Wnob6I9Swb4CkoPkKnczstjnpg3mpL4wRZCf EPgw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k2si605360edl.579.2020.05.14.23.57.15; Thu, 14 May 2020 23:57:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726496AbgEOGz3 (ORCPT + 99 others); Fri, 15 May 2020 02:55:29 -0400 Received: from relay7-d.mail.gandi.net ([217.70.183.200]:56439 "EHLO relay7-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbgEOGz3 (ORCPT ); Fri, 15 May 2020 02:55:29 -0400 X-Originating-IP: 42.109.214.107 Received: from localhost (unknown [42.109.214.107]) (Authenticated sender: me@yadavpratyush.com) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 5008920006; Fri, 15 May 2020 06:55:20 +0000 (UTC) Date: Fri, 15 May 2020 12:25:08 +0530 From: Pratyush Yadav To: masonccyang@mxic.com.tw Cc: vigneshr@ti.com, tudor.ambarus@microchip.com, juliensu@mxic.com.tw, richard@nod.at, miquel.raynal@bootlin.com, linux-kernel@vger.kernel.org, linux-spi@vger.kernel.org, broonie@kernel.org, linux-mtd@lists.infradead.org, Boris Brezillon , Pratyush Yadav Subject: Re: [PATCH v2 0/5] mtd: spi-nor: Add support for Octal 8D-8D-8D mode Message-ID: <20200515065508.6cra7nwt3jpxwvr2@yadavpratyush.com> References: <1587451187-6889-1-git-send-email-masonccyang@mxic.com.tw> <20200421092328.129308f6@collabora.com> <20200427175536.2mmei2fy6f7bg6jm@yadavpratyush.com> <20200428085401.574wmo6qddmumd7q@yadavpratyush.com> <20200429181856.kkavelcczylg4yxf@yadavpratyush.com> <20200506094028.2asq56goslfd2ngo@yadavpratyush.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mason, On 15/05/20 10:26AM, masonccyang@mxic.com.tw wrote: > > Hi Pratyush, > > > > > > I can't apply your patches to enable xSPI Octal mode for > > > > > mx25uw51245g because your patches set up Octal protocol first and > > > > > then using Octal protocol to write Configuration Register 2(CFG > > > > > Reg2). I think driver > > > > > should write CFG Reg2 in SPI 1-1-1 mode (power on state) and make > sure > > > > > write CFG Reg 2 is success and then setup Octa protocol in the > last. > > > > > > > > Register writes should work in 1S mode, because nor->reg_proto is > only > > > > set _after_ 8D mode is enabled (see spi_nor_octal_dtr_enable()). In > > > > fact, both patch 15 and 16 in my series use register writes in 1S > mode. > > > > > > but I didn't see driver roll back "nor->read/write_proto = 1" > > > if xxx->octal_dtr_enable() return failed! > > > > I copied what spi_nor_quad_enable() did, and made failure fatal. So if > > xxx->octal_dtr_enable() fails, the probe would fail and the flash would > > be unusable. You can try your hand at a fallback system where you try > > IMHO, it's not a good for system booting from SPI-NOR, > driver should still keep system alive in SPI 1-1-1 mode in case of > enable Octal/Quad failed. I agree. > Therefore, my patches is to setup nor->read/write_proto = 8 in case > driver enable Octal mode is success. And to enable Octal mode in > spi_nor_late_init_params()rather than as spi_nor_quad_enable()did. Like I mentioned before, spi_nor_late_init_params() is called _before_ we call spi_nor_spimem_adjust_hwcaps(). That call is needed to make sure the controller also supports octal mode operations. Otherwise, you'd end up enabling octal mode on a controller that doesn't support it with no way of going back now. But we can still have a fallback mechanism even in spi_nor_init() that would switch to a "less preferred" mode (like 1-1-1 mode) if "more preferred" ones like octal or quad fail. That said, I think it would be a good idea to not keep tacking features on this series. This makes it harder for reviewers because now they are trying to shoot a moving target. Let basic 8D support stabilize and get merged in, and then a fallback system can be submitted as a separate patch series. -- Regards, Pratyush Yadav