From: Mike Frysinger Date: Sat, 26 Dec 2009 13:40:45 -0500 Subject: [U-Boot] Remove board specific code from ENC28J60 network driver? In-Reply-To: <4B350B33.3040702@googlemail.com> References: <4B2E7B5B.3050603@googlemail.com> <200912201505.51636.vapier@gentoo.org> <4B350B33.3040702@googlemail.com> Message-ID: <200912261340.46179.vapier@gentoo.org> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On Friday 25 December 2009 13:57:55 Dirk Behme wrote: > I started to convert the enc28j60.c to common SPI framework. Do you > like to have a look at attachment (and maybe test it?)? > > It is compile tested only. And for the moment it just re-uses the > existing driver. When we know that it basically works this way, doing > it in a clean way as you describe above would be the next step. > CONFIG_NET_MULTI is still missing, too. spi_lock/spi_unlock should redirect to spi_claim_bus/spi_release_bus. this isnt so much an "interrupts" issue as the process of claiming the bus reprograms the controller with the slave settings. > In your config file you have to set and configure > > #define CONFIG_xxx_SPI > #define CONFIG_ENC28J60 > #define CONFIG_ENC28J60_SPI_BUS 0 > #define CONFIG_ENC28J60_SPI_CS 0 > #define CONFIG_ENC28J60_SPI_CLK 1000000 > #define CONFIG_CMD_NET > > for your board. this is ok with the current design, but broken for NET_MULTI. when converted to NET_MULTI, the new enc28j60_register() function will take the spi settings as function arguments. so the function would look something like: int enc28j60_register(bd_t *bis, unsigned int spi_bus, unsigned int spi_cs, unsigned int max_hz, unsigned int mode); and it'd be up to the board to call it with the settings it wants -mike