Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1406301ybb; Fri, 29 Mar 2019 04:02:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqw6LnIgB+GlUoQrIvvlNp0C+UBUTy7aMI4M1dK7DpEYjzWCROu7dn5ca2/pShfv95FBEep2 X-Received: by 2002:a17:902:a511:: with SMTP id s17mr47598298plq.262.1553857333969; Fri, 29 Mar 2019 04:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553857333; cv=none; d=google.com; s=arc-20160816; b=Onkq6OpyKY2fO2ZI90H0APJOgEdto29qa3hV1ayStit11zL6magY6NG92xJNXgrSHA QOBet+Jauvc8L5jEALlQgc6+XSsuvFGjGW9ZO5M4Vlot4Al+7neuz1evBatOQNw4KKFZ DEPtUV3AG1mfJOmU9RTkpV7QxPu5IfqoBrgobeHx4ay3Ll35vXey15brwgi7/y+dJXuc KjaH00OLphrB+W3Gf6mnTdrdR8LGGtDJyDEULMZiFvWYQ7jnuunFD2P7to/5ji1jjrfq f8eGLNUYnh6n5m0GwnyfVJNrkFrqjzGjdoaUXKetIkVgYxWkmYALwzrP6f+QCw9ikpRt hDdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3caNsEAYEqVE2i4jhAHj+wbfqzGZ3ZOweWv6j32fAWU=; b=q1TN4BsFu3qRE2ykauMfxzRf0IxeEkao5vHzZXxeM4Kz/l33iBHaR+KBCegPq9vK+K YQNoi1Sf3xPaKf5+2CpTWj/WByRa4fwBRl5C7Rc0OJMgM0Z64o4qh0q/KJ9bft/S/8AD WM2DGUdmSuolfnMz9PsuAaiOOZVO5n1GLb901uj2Tq3MGUY1QTW14ZuMmj7GN+kW25dT JfL4pyTZUbtRav/WVtP+KnbVAywLFmvS4lpPJn5BhIvg0/SNlG9e20ptYw5M0LBKwrA9 0blXlumhH9slVXekoZNQGMd6tanpUpKKJOYwlk6duiX3Ct9dE7t55WAkp9KrpQQU4WxP SrVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=b+WgoKnT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i195si1631414pgd.521.2019.03.29.04.01.57; Fri, 29 Mar 2019 04:02:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=b+WgoKnT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729410AbfC2LAu (ORCPT + 99 others); Fri, 29 Mar 2019 07:00:50 -0400 Received: from lelv0142.ext.ti.com ([198.47.23.249]:42234 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727675AbfC2LAu (ORCPT ); Fri, 29 Mar 2019 07:00:50 -0400 Received: from lelv0265.itg.ti.com ([10.180.67.224]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id x2TB0amX029831; Fri, 29 Mar 2019 06:00:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1553857236; bh=3caNsEAYEqVE2i4jhAHj+wbfqzGZ3ZOweWv6j32fAWU=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=b+WgoKnTe3+OkAPgZRmPTihI/DzSC1u9UVoLHTF/yOIWO198xZWpeRAy/yqFd7YLW pU4KPiTSc81xY4vwClPSvPhUrlzb5QwNs1wme5nARlcOtlzJa7x/lXUAHCX6wbHKQ3 /XR2JEdrt4nV6GgrZMt0JDNjDWrtJQvZRniHJnt8= Received: from DLEE113.ent.ti.com (dlee113.ent.ti.com [157.170.170.24]) by lelv0265.itg.ti.com (8.15.2/8.15.2) with ESMTPS id x2TB0aa1122100 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 29 Mar 2019 06:00:36 -0500 Received: from DLEE107.ent.ti.com (157.170.170.37) by DLEE113.ent.ti.com (157.170.170.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Fri, 29 Mar 2019 06:00:35 -0500 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE107.ent.ti.com (157.170.170.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5 via Frontend Transport; Fri, 29 Mar 2019 06:00:35 -0500 Received: from [172.24.190.89] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id x2TB0Viw075423; Fri, 29 Mar 2019 06:00:31 -0500 Subject: Re: [LINUX PATCH 2/3] spi: spi-mem: call spi_mem_default_supports_op() first To: Boris Brezillon CC: Naga Sureshkumar Relli , "broonie@kernel.org" , "bbrezillon@kernel.org" , "linux-spi@vger.kernel.org" , "dwmw2@infradead.org" , "marek.vasut@gmail.com" , "richard@nod.at" , "linux-mtd@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "michal.simek@xilinx.com" , "nagasuresh12@gmail.com" References: <1553771784-3364-1-git-send-email-naga.sureshkumar.relli@xilinx.com> <20190328205522.272e1da6@collabora.com> <20190329095307.02d970fd@collabora.com> From: Vignesh Raghavendra Message-ID: <850e1c59-8d00-31e5-e25a-72f36a52b86d@ti.com> Date: Fri, 29 Mar 2019 16:31:29 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190329095307.02d970fd@collabora.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 29/03/19 2:23 PM, Boris Brezillon wrote: > On Fri, 29 Mar 2019 13:50:26 +0530 > Vignesh Raghavendra wrote: > >> Hi Boris, >> >> On 29/03/19 1:25 AM, Boris Brezillon wrote: >>> On Thu, 28 Mar 2019 16:46:24 +0530 >>> Naga Sureshkumar Relli wrote: >>> >>>> Call spi_mem_default_supports_op() first, before calling controller >>>> specific ctlr->supports_op(). >>>> With this, controller drivers can drop checking the buswidths again. >>> >>> No, this was done on purpose, in case the controller does not want the >>> default check to be applied (say it does not need bus-width props to >>> be defined and has another way to check if a device can be accessed in >>> dual, quad or octal mode). >> >> Sorry, I don't understand here. >> Based on capabilities declared in spi_device->mode, m25p80 driver will >> claim appropriate SNOR_HWCAPS_*. SPI NOR layer chooses opcodes based >> on that for which m25p80 layer populates buswidths. > > Well, that test in m25p80 should go away and be replaced by a proper > spi_mem_supports_op() iteration on all modes reported as supported by > the *chip* (I think that's what I did in my series merging m25p80 code > into the spi-nor core). But that's not really related to the problem > we're discussing here. > I see that now. >> >> So, I don't really expect any mismatch in spi_mem_default_supports_op() >> in the case you mentioned. Or did I miss something? Maybe something SPI >> NAND specific? > > Nothing NAND specific, just something controller specific and how we > want to deal with buswidth detection. Most memory devices expose their > caps in some way (be it ID-based detection or using some kind of > caps/parameters table), so they know what they're capable of. SPI > controllers know what they're capable of, of course. The only part that > remains unknown for buswidth negotiation is how things are wired on the > board. I keep thinking that defining buswidth in the DT (using > spi-{tx,rx}-bus-width) should only be done if there are board-related > limiting factors (some IO pins not routed). > If you look at the code, SPI_{TX,RX}_{DUAL,QUAD,OCTAL} flags are only > set if the spi-{tx,rx}-bus-width props are defined. > > The idea behind making spi_mem_default_supports_op() optional is to let > new drivers implement a new scheme where missing > spi-{tx,rx}-bus-width does not necessarily mean "use regular SPI mode". > Ok, thanks for explanation. -- Regards Vignesh