From mboxrd@z Thu Jan 1 00:00:00 1970 From: Reinhard Meyer Date: Sat, 04 Sep 2010 05:25:12 +0200 Subject: [U-Boot] [PATCH] NET: add ENC28J60 driver using SPI framework In-Reply-To: <201009031814.17871.vapier@gentoo.org> References: <1282740459-7941-1-git-send-email-u-boot@emk-elektronik.de> <201009031703.56678.vapier@gentoo.org> <4C81675F.3030006@emk-elektronik.de> <201009031814.17871.vapier@gentoo.org> Message-ID: <4C81BC18.8070800@emk-elektronik.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 04.09.2010 00:14, Mike Frysinger wrote: > On Friday, September 03, 2010 17:23:43 Reinhard Meyer wrote: >> On 03.09.2010 23:03, Mike Frysinger wrote: >>>> not sure, however, if calling spi_setup_slave() is ok at this point. >>> >>> i believe the func should only doing validation on the arguments. it >>> shouldnt need to talk to any actual hardware. maybe this needs >>> codifying in the API documentation. >> >> In atmel_spi.c it sets up the csr[indexed by cs=0..3] register with clock, >> phase and polarity. >> That's harmless, but might need some rethinking there. > > i'm not familiar with the Atmel SPI controller, but my gut reaction is that > register values should be calculated in spi_setup_slave(), stored in the > internal xxx_spi_slave struct, and then written at spi_claim_bus() time. > -mike Well, the SPI hardware can store the settings for 4 chip selects, and quite automagically switch between them, including programmable switch times. When using DMA it would be possible to setup transfers to/from different chip selects without software doing the switches, ex: 15 words of 13 bits using 199kHz and mode 3 via CS2, 2 words of 8 bits using 10MHz and mode 0 via CS3, etc... All this, of course, is not needed in u-boot and currently only half used anyway. Therefore I tend to rework the atmel_spi.c not to make use of that feature at all. For codig the ENC driver I will just postulate its save to setup the slave at initialize time. Reinhard