From owner-freebsd-arch@FreeBSD.ORG Wed Sep 5 14:26:54 2012 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 780B0106564A for ; Wed, 5 Sep 2012 14:26:54 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ie0-f182.google.com (mail-ie0-f182.google.com [209.85.223.182]) by mx1.freebsd.org (Postfix) with ESMTP id 346568FC12 for ; Wed, 5 Sep 2012 14:26:53 +0000 (UTC) Received: by iebc12 with SMTP id c12so1580466ieb.13 for ; Wed, 05 Sep 2012 07:26:53 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=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=llCQJXE1CKAl3BXFYPV+KVu5wNwU9OC8bBCXzCgtCJw=; b=H9s0iRZo1Gl+MT9lPFlD/5UJZJz90ONLIzy8/tEIbAUKj+WONPspqHv9PXOFnllU7a /Wi62S4xtsxchpCLqDLsFQZ+f/rPjYKB2GaV9WJbUdvemU2feVKVRF+4Kr6luKy7XVUN 79j1KdUlnHqGfofBD63X45EdvAjRecOZfFCc9MY7kUfjHlEGyy4O/Bha2IH9F/pkC4gE aZlEnF7DB5rvElL+G/E1coXKTBSnxVxLOITDhdlUjFaMgTKvo7+r+TXp7sy7HgSSUx1g O1pYkFKbK6k/HRyospe06rkyRpR16wsZ1XGoKnv9MZAQ1FYqG/dWI0G/Z7VvTpidzwiO MWzQ== Received: by 10.43.131.193 with SMTP id hr1mr21414011icc.31.1346855213589; Wed, 05 Sep 2012 07:26:53 -0700 (PDT) Received: from 63.imp.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPS id p5sm16226531igm.13.2012.09.05.07.26.48 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 05 Sep 2012 07:26:49 -0700 (PDT) Sender: Warner Losh Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: <1346683262.1140.582.camel@revolution.hippie.lan> Date: Wed, 5 Sep 2012 08:26:46 -0600 Content-Transfer-Encoding: quoted-printable Message-Id: References: <1346602529.1140.563.camel@revolution.hippie.lan> <3C91462E-1423-4AFC-B4C7-6239E698A98E@bsdimp.com> <1346683262.1140.582.camel@revolution.hippie.lan> To: Ian Lepore X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQloURbVyax81cjaCvxcf10vaAbAOiWZhD0ByRDYUGBxtih1h3Rb/69aHM+equxJRaCoDz1p Cc: freebsd-arch@freebsd.org, Luiz Otavio O Souza Subject: Re: spibus access serialization X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 05 Sep 2012 14:26:54 -0000 On Sep 3, 2012, at 8:41 AM, Ian Lepore wrote: > On Sun, 2012-09-02 at 13:38 -0600, Warner Losh wrote: >>> Unfortunately, the atmel SPI controller will de-assert the chip >> select >>> when the transmit register (or PDC) runs out of data. It's a bug >> that >>> may only affect rm9200; I haven't checked the errata and docs for >> the >>> sam9 series to see if they fixed it. >>=20 >> Yes, that's been fixed (which is why I didn't think it would be a >> problem, but it is). >>=20 >>> The way to fix the problem is indeed to take over the handling of >> chip >>> selects in the driver, by taking the pins away from the device and >>> managing them as GPIOs. Doing that is on my to-do list, but I've >> been >>> waiting for some resolution of the "how do we manage device/gpio pin >>> setup across the atmel SoC family" questions. >>=20 >> That's the question still, alas. I've been looking at how FDT does = it >> in Linux land, and they punt on this issue. We'll likely have to put >> some effort into defining these things with atmel's FDT efforts. >> Their FDT comes close by defining groups, but doesn't seem to take it >> down to the individual pin to signal mapping.=20 >=20 > Hmmm, if the workaround is needed only on rm9200 hardware, then there > are only two choices for where the chip select pins live (PIOA or PIOD > banks). I think it should be possible to sniff out whether the chip > select pins have been configured to PIOAn or PIODn by reading the > periphid registers, so we could potentially get the SPI code fixed > without solving the difficult problem of managing pin assignments = across > different SoCs in the family. >=20 > I should have sam9 hardware arriving in a couple weeks, then I'll be > able to make changes and test that they work on rm9200 and sam9. I think a full test for this serialization might be the ENC28J60 SPI = Ethernet module. You can get one here on ebay: = http://www.ebay.com/itm/Mini-ENC28J60-Ethernet-LAN-Network-Module-For-51-A= VR-STM32-LPC-/140843724204?pt=3DBI_Electrical_Equipment_Tools&hash=3Ditem2= 0caf0adac for < $5.00. There are Linux drivers available, and the datasheet for = this item appears to be fairly complete. This board would be easy to = connect to the SPI bus of the G45 board you are getting with standard = jumpers. I recently bought a bunch on Amazon for about $5.00. If you = could support this on a board that also had a dataflash, you'd be sure = that the spi system was good. However, in looking at it, we'd need to beef up the at91 gpio stuff a = bit, since it needs an interrupt line and a reset line. Warner=