spibus access serialization

Warner Losh imp at bsdimp.com
Wed Sep 5 14:26:54 UTC 2012


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.
>> 
>> Yes, that's been fixed (which is why I didn't think it would be a
>> problem, but it is).
>> 
>>> 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.
>> 
>> 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. 
> 
> 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.
> 
> 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-AVR-STM32-LPC-/140843724204?pt=BI_Electrical_Equipment_Tools&hash=item20caf0adac

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


More information about the freebsd-arch mailing list