Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752526AbbGAFuF (ORCPT ); Wed, 1 Jul 2015 01:50:05 -0400 Received: from mx6-out11.antispamcloud.com ([95.211.2.202]:38509 "EHLO mx6-out11.antispamcloud.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751003AbbGAFt7 convert rfc822-to-8bit (ORCPT ); Wed, 1 Jul 2015 01:49:59 -0400 Message-ID: <55937F74.1020801@topic.nl> Date: Wed, 1 Jul 2015 07:49:40 +0200 From: Mike Looijmans Organization: TOPIC User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: =?ISO-2022-JP?B?IkJlYW4gSHVvIBskQnA5SUxJTBsoQiAoYmVhbmh1byki?= CC: "git@xilinx.com" , "linux-kernel@vger.kernel.org" , "dwmw2@infradead.org" , "computersforpeace@gmail.com" , "linux-mtd@lists.infradead.org" Subject: Re: [PATCH] mtd: spi-nor: Only set Micron quad-read mode when controller in 4-lane TX mode References: <1435663042-25425-1-git-send-email-mike.looijmans@topic.nl> In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8BIT X-Originating-IP: [192.168.80.121] X-EXCLAIMER-MD-CONFIG: 9833cda7-5b21-4d34-9a38-8d025ddc3664 X-EXCLAIMER-MD-BIFURCATION-INSTANCE: 0 X-Filter-ID: s0sct1PQhAABKnZB5plbIbbvfIHzQjPVmPLZeVYSu3xU9luQrU+8/8qthi+0Jd/W6KAUC/fjyuDn NXFr4uarw1/CcW6fnvdfO7/BzHH95Ilmtfv+FqJdBAzMzmkl3Reb7OPLTgLP32G0yf3Ag7h/FIb1 WDwePMnKzPdVOG3dYiAIU5UCUGp2cClofKgyrtfplE0HlM08xonmnjSiziWecO63p/UbUTcmIpuX txg/Cxnu3vFjijOFYEeREeY6Hf1xfw1LCrmKe0d1Tk7GylExnqkEdurK397sVy0EXeFT7u1uKx+S 3LOKsd/v3VqVoKVt2reSXbSP2/KIB8yNBReIUL6XkcrECKWbR/6RlQ8Exa+/bui/OXSHlEDpM9M1 t8LiaEH5pYtN3G2m2OZI6/7f6E6xi8EZ4WW0JLHfUkoV2m+bldlLGICeO1yDX4HSP41mblOeZJzM 1oDi3/BPzig/KE6uzT1rV3nBYwb/yZkYg3pjO8k2UKH3CS8PkRCHkOz4B3RW25a1fWgYagjKHqnP 4SaVYAK7RYLucgpI9hVoEADiScRMpzaZq1e3HKcSuk1lURRi3S6+AQx4IrUR7KI8S5CqsoiKgqJ7 +go1Wd9qFlKtxY4RI+p8dbpdBZidxy/uGh6jYjrx6fqqqDIxrbcQSfAFMvX7q8M4x6bP/gjzw0Ps +QiTo226grWN9qgJmbLGdYcE1HFY83SD9r9Zu9me7X9PMKEgDZDQXQfXQIjgcELLS2lO9JJKeVTZ PGFooqIHfx4RJNUC8/qr6iBwYqUSSWiH1Wgh6RAenBR+licROGaLFZNCPVqjpwKOa9bXgZVSJpJ2 +wjlFZ2K9sgfnbx5HydvDXRCdOvJyYXB5wS1hX0Prc1/rsEneImSwq7Qphvy X-Report-Abuse-To: spam@mx99.antispamcloud.com X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJXhXyDRoOQM5J3kcUr0HrMvJUWjZ8+qhjyB23tbDuyLOYL8Ff78gYsez 4Rl08xudmXi4esCQ0R1MchVjt7wblGlvhFgW0MjUMRkF5sMCDfftTXNFDzN17hnrWeZYOJvLq0Ic WjZ+XcEjj/7Pkld0zkmvziDInX9WdMov2kn2yXjdwv61T+KDYyYtREgszdyFwv8IxCB3p/oCKvxr eyISh3JGb7OS5oVgiO+kDxZrVPLz3MmEGC2PrUKqLq5WmHK+Nw== X-Originating-IP: 88.159.208.100 X-Spampanel-Domain: topic.nl X-Spampanel-Username: 88.159.208.100 Authentication-Results: antispamcloud.com; auth=pass smtp.auth=88.159.208.100@topic.nl X-Spampanel-Outgoing-Class: ham X-Spampanel-Outgoing-Evidence: Combined (0.00) X-Recommended-Action: accept Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2802 Lines: 69 On 01-07-15 04:19, Bean Huo 霍斌斌 (beanhuo) wrote: >> drivers/mtd/spi-nor/spi-nor.c | 2 ++ >> 1 file changed, 2 insertions(+) > >> diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c index e8f6131..10ba94f 100644 >> --- a/drivers/mtd/spi-nor/spi-nor.c >> +++ b/drivers/mtd/spi-nor/spi-nor.c >> @@ -1398,6 +1398,8 @@ static int set_quad_mode(struct spi_nor *nor, struct flash_info *info) > > } > > return status; > > case CFI_MFR_ST: >> + if (!(nor->spi->mode & SPI_TX_QUAD)) >> + return 0; > I think, this action should be done before callback set_quad_mode,and add some codes in > Spi controller driver.what is more,how do you get spi member in spi_nor?seems no this member. Too many changes between the Xilinx tree and mainline. My patch isn't for mainline, I'll make a new one. > I have one concern that as long as spi nor be configed into quad mode,spi controller must be also > immediately Transfer into quad mode, otherwise read status will be fail. The original commit that added the micron Quad mode did not do this. I wonder how this was tested, because it could never have worked on any setup I'm aware of. After setting the "quad mode" bit in volatile config, the controller needs to start sending commands on all 4 lanes. Even if it succeeds in doing that, a soft reset (e.g. unloading/loading the driver, or kexec to another kernel) will bring the system in a state where the controller will use 1 lane for commands while the chip expects 4, thus breaking all communication. Having slept and pondered about this, I suggest plainly removing the Micron Quad mode code, because it is just broken and can never work. There's no actual performance advantage here, apart from just saving a few clocks on commands, which would be less than 0.1% on a 1k data read. > But setting spi controller layer(driver/spi/) and configure spi nor layer(driver/mtd/spi-nor) > are not the same mtd layer,I found that it's hard to do. > But for new structure spi controller(such as driver/mtd/spi-nor/fsl-quadspi.c) is very reasonable.and > it can be easy to set spi controller and spi nor into quad mode at the same time. I'm sorry, but I didn't understand what you meant here. Kind regards, Mike Looijmans System Expert TOPIC Embedded Products Eindhovenseweg 32-C, NL-5683 KH Best Postbus 440, NL-5680 AK Best Telefoon: +31 (0) 499 33 69 79 Telefax: +31 (0) 499 33 69 70 E-mail: mike.looijmans@topicproducts.com Website: www.topicproducts.com Please consider the environment before printing this e-mail -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/