Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752281AbbHEM4w (ORCPT ); Wed, 5 Aug 2015 08:56:52 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:37605 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751356AbbHEM4u (ORCPT ); Wed, 5 Aug 2015 08:56:50 -0400 MIME-Version: 1.0 In-Reply-To: <20150805124412.GN20873@sirena.org.uk> References: <1438072876-16338-1-git-send-email-vigneshr@ti.com> <1438072876-16338-2-git-send-email-vigneshr@ti.com> <20150731181745.GM20873@sirena.org.uk> <55BEF4AF.5090704@ti.com> <20150804155148.GR20873@sirena.org.uk> <55C0FD98.1090107@ti.com> <20150805115013.GJ20873@sirena.org.uk> <20150805124412.GN20873@sirena.org.uk> From: Michal Suchanek Date: Wed, 5 Aug 2015 14:56:09 +0200 Message-ID: Subject: Re: [RFC PATCH 1/5] spi: introduce flag for memory mapped read To: Mark Brown Cc: "R, Vignesh" , devicetree , Brian Norris , Russell King , Tony Lindgren , Linux Kernel Mailing List , linux-spi , Huang Shijie , MTD Maling List , linux-omap@vger.kernel.org, David Woodhouse , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1908 Lines: 41 On 5 August 2015 at 14:44, Mark Brown wrote: > On Wed, Aug 05, 2015 at 02:40:01PM +0200, Michal Suchanek wrote: >> On 5 August 2015 at 13:50, Mark Brown wrote: > >> > As far as I can tell you want to set a per spi_message flag saying that >> > the message is a flash read command? If that's what this is trying to >> > do then why do you need to set the flag at all? If the message is in a >> > clearly defined format and it's more efficient to use this mmap mode >> > then surely the driver can just recognise that the format is approprate >> > and switch into mmap mode without being explicitly told - I'm not clear >> > what the flag adds here. > >> ehm, the read command is just one byte. > >> I don't think sending 03 or other random byte as the first byte of a >> SPI transfer can be used as reliable detection that we are talking to >> a SPI flash memory. > > Why care - if something is physically in the same format as a flash read > command how would a device be able to tell that it wasn't actually a > flash read command? The signals sent on the bus are going to be > identical anyway. Not only must the command be the same but also the response must be tha same. The flash chip responds by sending arbitrary amount of data. Given that transfer_one gets only the part that sends the read command and the part to do the actual read may or may not follow this is getting a bit hairy. Add in dummy bytes due to fast-read lag and page write wrap-around and you get something that you definitely do not want unless you are really sure that there is a flash memory on the other end of the wire. Thanks Michal -- 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/