From owner-freebsd-mips@FreeBSD.ORG Thu Feb 21 23:02:59 2013 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id 7A42A98E for ; Thu, 21 Feb 2013 23:02:59 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-yh0-x231.google.com (mail-yh0-x231.google.com [IPv6:2607:f8b0:4002:c01::231]) by mx1.freebsd.org (Postfix) with ESMTP id 3B9F632B for ; Thu, 21 Feb 2013 23:02:59 +0000 (UTC) Received: by mail-yh0-f49.google.com with SMTP id m1so12833yhg.22 for ; Thu, 21 Feb 2013 15:02:58 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-received:sender:subject:mime-version:content-type:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to:x-mailer:x-gm-message-state; bh=18hoJwfk6xsq6duaD+G5D0Ouaw0gSr3f7iGliAf0gl4=; b=Dxw5tkvsgszcY31M9OFf459Xmt6zihpycUskSz9zZrDCN8fwCvGqWtJS8GdMsLCRVv 2oS+rxWItaatC6g69jnaBlvTWn979dEhHJEoonwFWHE4cDDS6cToQLU+Do2XWbCOjOGT rwtTjWEO5kiCSHYa9tEkqyUa5uB/r4QNtxftmlZGRhuaegcdEwCo/FNtrtTZO9u4IJhM GWROh86F5EcnXhGCYoR18E7c14F8vxUYqjR5cBP724EZ84fSW7Eg0yuYnlNlzcGVRatx deEB1OJVR789gum2kgsgPaKDG3J5NW3ymJ+bFNNFuyNAp5Cf7El2NyoPXdFUK0YYkXKZ r9KQ== X-Received: by 10.236.139.113 with SMTP id b77mr48035628yhj.130.1361487778466; Thu, 21 Feb 2013 15:02:58 -0800 (PST) Received: from monkey-bot.int.fusionio.com ([209.117.142.2]) by mx.google.com with ESMTPS id f20sm288851ang.10.2013.02.21.15.02.56 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Feb 2013 15:02:57 -0800 (PST) Sender: Warner Losh Subject: Re: SPI, _sz fields in struct spi_command Mime-Version: 1.0 (Apple Message framework v1085) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <20130222005926.2aa6db7f.ray@freebsd.org> Date: Thu, 21 Feb 2013 16:02:54 -0700 Content-Transfer-Encoding: 7bit Message-Id: References: <20130220142140.f8e5a616c75d72e2519dbc69@freebsd.org> <54C08D8E-4C5F-49AF-BEE6-D78EC05D2A24@bsdimp.com> <20130220174449.GB6976@cicely7.cicely.de> <20130221022655.6f693eb6.ray@freebsd.org> <20130221014433.GA12189@cicely7.cicely.de> <20130221163026.dbeb03f9c38de3d24a7ab30f@freebsd.org> <20130221163003.GC12189@cicely7.cicely.de> <20130222000207.d1478231.ray@freebsd.org> <1361486385.1185.38.camel@revolution.hippie.lan> <20130222005926.2aa6db7f.ray@freebsd.org> To: Aleksandr Rybalko X-Mailer: Apple Mail (2.1085) X-Gm-Message-State: ALoCoQnf+NDIUVJAiTi0Irfp87I4pg9vXDCs575HesRxa6Ri1BMz87gtt32mlrCum3RI04Tu/Ktk Cc: freebsd-arm@FreeBSD.org, Bernd Walter , ticso@cicely.de, Ian Lepore , 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: Thu, 21 Feb 2013 23:02:59 -0000 On Feb 21, 2013, at 3:59 PM, Aleksandr Rybalko wrote: > On Thu, 21 Feb 2013 15:39:45 -0700 > Ian Lepore wrote: > >> On Fri, 2013-02-22 at 00:02 +0200, Aleksandr Rybalko wrote: >>> On Thu, 21 Feb 2013 17:30:03 +0100 >>> Bernd Walter wrote: >>> >>>> On Thu, Feb 21, 2013 at 10:21:00AM -0500, Patrick Kelsey wrote: >>>>>> On Thu, Feb 21, 2013 at 9:30 AM, Aleksandr Rybalko >>>>>> wrote: >>>>>>> On Thu, 21 Feb 2013 02:44:33 +0100 >>>>>>> Bernd Walter wrote: >>>>>>> >>>>>>> On Thu, Feb 21, 2013 at 02:26:55AM +0200, Aleksandr Rybalko >>>>>>> wrote: >>>>>>>> 2. teach consumers to give only correct numbers (very nice >>>>>>>> we have only two SPI devices in tree) >>>>>>>> >>>>>>>> After that we will be able to make drivers for some >>>>>>>> (potential) devices which will require bidirectional >>>>>>>> communication. And controllers which can't do that, will >>>>>>>> just report error in that. I believe peoples thinks before >>>>>>>> attach such devices to controllers, so we will not have >>>>>>>> such incompatibility. >>>>>>> >>>>>>> I don't think there are many devices requiring RX/TX at the >>>>>>> same time. >>>>>> >>>>>> Anyway, we will be able to do that, and we don't care now >>>>>> because don't have such drivers yet. >>>>>> >>>>> >>>>> Taking the view that "RX/TX at the same time" means that one >>>>> wants to send meaningful data to the slave device at the same >>>>> time one is interested in what data is returned during that >>>>> transmission, there are such devices in use out there. Linear >>>>> Technologies has several ADCs, such as the LTC2446, for which >>>>> you obtain the previous conversion result while sending the >>>>> configuration bits for the next conversion to be performed. >>>> >>>> Forgot about ADC with channel selection. >>>> >>>>> Although this is slightly out of focus for the specific issue >>>>> originally raised, while on the topic of things that need to get >>>>> done on SPI in real systems, there are also devices out there >>>>> that require specific data or some number of clocks to be >>>>> provided while chip select is deasserted. One example of the >>>>> former is the LTC2404, which is a multichannel ADC for which >>>>> the input channel for the next conversion is selected by the >>>>> last four bits clocked in *before* chip select is asserted. >>>>> One example of the latter is the spec for SPI access to MMC/SD >>>>> cards, which requires a certain number of clocks to be applied >>>>> with chip select deasserted in order to initialize the card. >>>>> If you ever find yourself wondering why an SPI software >>>>> interface provides independent bus acquisition and chip select >>>>> control, the reason is to support these types of devices. >>>> >>>> With many ADC you also want probing support. >>>> Assign CS and GPIO-read MISO for ready without clocking. >>>> Some flash chips also work this way. >>>> Not sure if AT45DB support this and how our driver works. >>>> With own projects I usually ask AT45DB about ready state by >>>> transfering a status word. >>>> >>>> -- >>>> B.Walter http://www.bwct.de >>>> Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner >>>> uvm. >>> >>> Guys, I don't said it will not be supported. :) >>> I said drivers of controllers who can't will return error in that >>> case, but other might be ok. >>> >>> So, conclusion: go-go-go ray! do it please! >>> :-D >>> >> >> One other little thought to consider... since tx and rx size must be >> the same if they're both non-zero, then could we change to having a >> single io_size field, and pass a NULL pointer for rx or tx buffer if >> that part of the transfer isn't needed? >> >> -- Ian >> >> > > Yeah, very-very good idea! That how my uncommited driver for i.MX515 > SPI works :) > > Objections? I'm cool with that. Warner