Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1116956pxb; Fri, 6 Nov 2020 01:07:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCiZWBM6shRXhk9YxqvjDg+FQ19os7STfdKxKistP/Y42MrNrKOIfz4hPcxDc6DaoTwYBo X-Received: by 2002:a17:907:4302:: with SMTP id nh2mr1016386ejb.451.1604653646652; Fri, 06 Nov 2020 01:07:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604653646; cv=none; d=google.com; s=arc-20160816; b=T77Mc0vYHY8N41XFAUPkIXpbbmbsmwllCUTT7oOOmDev7Kk30UiO0crA2RoE7GkYKf /0l3jwY0eNQQDxrotmL6bj83raxKdp0AqKjfyJIfis1KdezL3tbm5bYLzDY/ltMJHzo1 k3gZL6wZL2bCJgEYLuaVglc9yKBwGebymFDFAfqXoRAcFAC+6Y4o5Hm+X69VrbTB8DN7 Dvbrn5/4+F6JCvSisjggaimM0WXiDXUcuEs+nCm4oq7PGg3kQb+dahSUUc+j10WuzB54 Fegv+Ookf8cd6morIkkV6P8ys6uTr268IBM76VP4jCu7sXcslIHKmTzS5JW/5xrm8FbC Eb3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date; bh=evMFqAiA7p3JVKZq7yydbu+UZxoo0DIdIJenO+oiILA=; b=k+FEDSwxi+03l7K5Zh+ImwM29OYUaPPMExncAuRy3uDwP0Wd9ik38miMI/iEIFN2wC 0XLRqzoAvvjFcWWt+FMtfQWXXz1iPx9+oQB49+fBERQxyn6dUE59IU3A8U8m5JtZwYZo vUsml5HKZTl+yeX06CUcXAsB9QmDyR5NJODIFmgLxAXbOVANOJ2Q5RX80TyiCfBnhuo1 i0cpfhA+edoMx77uX4DbXtFvRrK95iGO+pIcSWKhO1gXOvgjtR2vfJ2hW/NSgsrQejgb /aAJqlS/wSBAGNZx2cB4lnywO5wff/m4kb8iPNKTzFYmFQd8p8P5CXbPuR5qQftzrzGl ZzaQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z8si519004edp.59.2020.11.06.01.07.03; Fri, 06 Nov 2020 01:07:26 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726423AbgKFJFp convert rfc822-to-8bit (ORCPT + 99 others); Fri, 6 Nov 2020 04:05:45 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:59210 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725848AbgKFJFo (ORCPT ); Fri, 6 Nov 2020 04:05:44 -0500 Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: bbrezillon) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 2CDA51F4679D; Fri, 6 Nov 2020 09:05:42 +0000 (GMT) Date: Fri, 6 Nov 2020 10:05:39 +0100 From: Boris Brezillon To: Chin-Ting Kuo Cc: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater , "robh+dt@kernel.org" , "broonie@kernel.org" , "joel@jms.id.au" , "andrew@aj.id.au" , "bbrezillon@kernel.org" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-aspeed@lists.ozlabs.org" , "linux-spi@vger.kernel.org" , BMC-SW Subject: Re: [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller driver Message-ID: <20201106100539.62fc5249@collabora.com> In-Reply-To: References: <20201105120331.9853-1-chin-ting_kuo@aspeedtech.com> <20201105120331.9853-5-chin-ting_kuo@aspeedtech.com> <20201105161132.37eb3265@collabora.com> Organization: Collabora X-Mailer: Claws Mail 3.17.7 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Nov 2020 08:58:23 +0000 Chin-Ting Kuo wrote: > Hi Boris, > > Thanks for your quick reply. > > > -----Original Message----- > > From: Boris Brezillon > > Sent: Thursday, November 5, 2020 11:12 PM > > To: Cédric Le Goater ; robh+dt@kernel.org > > Cc: Chin-Ting Kuo ; broonie@kernel.org; > > joel@jms.id.au; andrew@aj.id.au; bbrezillon@kernel.org; > > devicetree@vger.kernel.org; linux-kernel@vger.kernel.org; > > linux-aspeed@lists.ozlabs.org; linux-spi@vger.kernel.org; BMC-SW > > > > Subject: Re: [v3 4/4] spi: aspeed: Add ASPEED FMC/SPI memory controller > > driver > > > > Hi, > > > > On Thu, 5 Nov 2020 15:09:11 +0100 > > Cédric Le Goater wrote: > > > > > Hello Chin-Ting, > > > > > > Thanks for this driver. It's much cleaner than the previous and we > > > should try adding support for the AST2500 SoC also. I guess we can > > > keep the old driver for the AST2400 which has a different register layout. > > > > > > On the patchset, I think we should split this patch in three : > > > > > > - basic support > > > - AHB window calculation depending on the flash size > > > - read training support > > > > I didn't look closely at the implementation, but if the read training tries to read > > a section of the NOR, I'd recommend exposing that feature through spi-mem > > and letting the SPI-NOR framework trigger the training instead of doing that at > > dirmap creation time (remember that spi-mem is also used for SPI NANDs > > which use the dirmap API too, and this training is unlikely to work there). > > > > The SPI-NOR framework could pass a read op template and a reference pattern > > such that all the spi-mem driver has to do is execute the template op and > > compare the output to the reference buffer. > > > > I agree it. Before, I were not able to find a suitable location to implement read training feature. > I think that I can add a SPI timing training function in "spi_controller_mem_ops" struct and > call it by a wrapper function called at the bottom of spi_nor_probe() in spi-nor.c. > Maybe, SPI-NOR framework does not need to pass reference buffer since calibration > method depends on each SoC itself and buffer size may be variant. > The detail calibration method may be implemented in each SoC SPI driver. That's a real problem IMO. What makes this pattern SoC specific? I can see why the location in flash could be *board* specific, but the pattern should be pretty common, right? As for the spi-mem operation to be executed, it's definitely memory specific (I can imagine some flash vendors providing a specific command returning a fixed pattern that's not actually stored on a visible portion of the flash). > > Besides, I am thinking about the possibility for adding a "spi_mem_post_init" function in > spi-mem framework sine for some SoCs, SPI controller needs to adjust some settings > after getting SPI flash information. I don't think that's a good idea. The spi-mem interface should stay memory-type agnostic and doing that means we somehow pass NOR specific info. What is it that you need exactly, and why?