Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751707AbbGAFlC (ORCPT ); Wed, 1 Jul 2015 01:41:02 -0400 Received: from mx12-out14.antispamcloud.com ([46.165.232.184]:56866 "EHLO mx12-out14.antispamcloud.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750793AbbGAFkz convert rfc822-to-8bit (ORCPT ); Wed, 1 Jul 2015 01:40:55 -0400 Message-ID: <55937D58.9090102@topic.nl> Date: Wed, 1 Jul 2015 07:40: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: Graham Moore CC: , , , , , 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> <5592B8FE.3050601@opensource.altera.com> In-Reply-To: <5592B8FE.3050601@opensource.altera.com> Content-Type: text/plain; charset="utf-8"; format=flowed 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+FqJdBAzMzmkl3RebkmNtYaaHSZ1T8pv+ZL8fDa3u J0ppY8PjW9kQJDQ2DfqhXHAu9PXkk3+ufpr9mUCp49ygX5t4G6CjSAk6q4KOGt0XyGJA2j9OjBq+ 7AxH2md8+aYugcFTXpbbk1SUWL5XHFKxfQIvOK8bNHfBxyzgFHcpU4NAtqigRIX9dr2LCdx3fd8F kND89zomVu4ON6x9ysTGPtzrAXuMX5kFte8ARXNlQqqxmdZzyxpHv2E8XuEb2jl9qhquqgno1HKv gl7iFgQkLCCwgkd29EA3Mn/21izRr0tW1ONgQoHJVKPDfKLqLyYlF+6jPbsmhBxoVZcjkzEenZ+H YGTaYlw+q6t3fmk6MJ8NpTAimLdMnwNlUVzlgTl6fJxyntEfhZCKje4Z4BwUBtAK1krdspYrHZmb qfMr4nKr2dCrOCybehM93Z0t3diy2xBLkKIBdpruTHi8Glbpqcvu0LyxnPy8ff4CZS2j3hDNp4wZ eJLOSm3r4j6QD7chBCoJW0bwJ8gLWssY0sxDsEeIlu7nzGueW9+wfGs0ufkZZ16cDW6AzHwWX8RL 3huUJbTOjvNyblq9u7qi/2rAztFeklLxGNN3KHaPkEw9uhpny+v4xsJzr92RwsFAHnn58K59uffk N3xWVSPH4IxQI5amry3QjTbHZAgw3wsM/fz6+ix4Ga3gGIVlVBnshLQgVKcSXxZyEYhEeUBY++Du IQUs/5JJj4C/n4CILssLgymhfT85Jh8DCdjiI8i95I/ld/SrF8iWbceMen68aym4y4Pb/zez7XtN 4AN3yUcLyeJtje1IlW/3ADskZVA= X-Report-Abuse-To: spam@mx99.antispamcloud.com X-Filter-Fingerprint: IFrWXGses7OKB5S5G8/dJcFIkh7yuznlTeFPLSNUgKbJUWjZ8+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: 2639 Lines: 74 On 30-06-15 17:42, Graham Moore wrote: > On 06/30/2015 06:17 AM, Mike Looijmans wrote: >> Micron QUAD mode expects command, address and data on 4 lanes instead of just >> one for command (extended SPI mode). This requires the controller to be in a >> special mode, so check first if the controller could be in that mode. If a >> controller does not have the SPI_TX_QUAD mode set, this setting has no chance >> of being valid at all, so don't try to enable it then, and just keep using >> the extended SPI mode. >> >> Tested on a Zynq 7000 with a n25q256a flash chip, this failed to function >> because of the introduction of: >> "driver:mtd:spi-nor: Add quad I/O support for Micron spi nor" >> This commit sets QUAD mode for most Micron chips without asking the controller >> whether it's possible to do so, and without telling the controller that a >> different mode is required, so it couldn't work. >> >> Signed-off-by: Mike Looijmans >> --- >> 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; > > This is a great idea, but what codebase are you working from? My l2-mtd tree > doesn't have a 'spi' member of spi_nor, and this case statement is around line > 977, not 1398. I was working from the Xilinx kernel tree, and there's a lot of changes there. The one that added the "struct spi_device* spi" to the nor struct is: 63697f5cf9a6201556947ef0ea29442843e5ba61 mtd: spi-nor: Changes for stacked and parallel >> status = micron_quad_enable(nor); >> if (status) { >> dev_err(nor->dev, "Micron quad-read not enabled\n"); >> 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/