From owner-freebsd-mips@FreeBSD.ORG Wed Apr 10 18:51:00 2013 Return-Path: Delivered-To: freebsd-mips@FreeBSD.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 3167F4AF; Wed, 10 Apr 2013 18:51:00 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) by mx1.freebsd.org (Postfix) with ESMTP id 098321EF; Wed, 10 Apr 2013 18:50:59 +0000 (UTC) Received: from c-24-8-230-52.hsd1.co.comcast.net ([24.8.230.52] helo=damnhippie.dyndns.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1UQ06k-000DgC-Bx; Wed, 10 Apr 2013 18:50:58 +0000 Received: from [172.22.42.240] (revolution.hippie.lan [172.22.42.240]) by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id r3AIouIH030047; Wed, 10 Apr 2013 12:50:56 -0600 (MDT) (envelope-from ian@FreeBSD.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 24.8.230.52 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX19f+OQ6qu22rd9vaAoy1A3d Subject: Re: [PATCH] MMC/SD SPI-mode driver From: Ian Lepore To: Adrian Chadd In-Reply-To: References: <20130407011307.9a9a9d64.ray@freebsd.org> <20130407022428.86a66c6a.ray@freebsd.org> <20130408153334.9cc11688aedbf32dcbf83a7b@freebsd.org> <1365605147.41399.227.camel@revolution.hippie.lan> <1365609642.41399.237.camel@revolution.hippie.lan> Content-Type: text/plain; charset="us-ascii" Date: Wed, 10 Apr 2013 12:50:56 -0600 Message-ID: <1365619856.41399.242.camel@revolution.hippie.lan> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 FreeBSD GNOME Team Port Content-Transfer-Encoding: 7bit Cc: Aleksandr Rybalko , Dmytro , freebsd-mips@FreeBSD.org X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2013 18:51:00 -0000 On Wed, 2013-04-10 at 10:21 -0700, Adrian Chadd wrote: > On 10 April 2013 09:00, Ian Lepore wrote: > > > I don't understand how reading is not a generic spi command > > (presupposing the existance of the proposed changes that allow for a spi > > read without a concurrent write and vice versa). > > No. Reading is an SPI method. But the SPI flash command for reading > data is different than other SPI commands. > > The only thing we should be doing this for is SPI _flash reads_. Not > SPI reads. Just data area reads from a directly attached flash chip. > > It's dirty or inefficient any way we do this. Either we special case > spibus drivers, or we expose a SPI read / SPI write 'command' that > knows it's not a generic SPI bus transaction but specifically a > read-this-flash-data-from-this-offset-and-length transaction. Or some > other kind of dirty hack. > Maybe something like this could work? static int ar71xx_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) { if (cmd->cs == sc->magic_mapped_flash_chipsel && cmd->tx_cmd == NULL && cmd->tx_data == NULL && *(uint8_t *)cmd->rx_cmd == SPIFLASH_READ_OPCODE && /* maybe some other constraints I don't know about */ /* maybe even check that child is the mx25l driver */) return do_magic_mapped_read(...); else return do_mundane_nonmapped_transfer(...); } -- Ian