From mboxrd@z Thu Jan 1 00:00:00 1970 From: Reinhard Meyer Date: Fri, 03 Sep 2010 22:31:47 +0200 Subject: [U-Boot] [PATCH] NET: add ENC28J60 driver using SPI framework In-Reply-To: <201009031551.04080.vapier@gentoo.org> References: <1282740459-7941-1-git-send-email-u-boot@emk-elektronik.de> <201008252355.22876.vapier@gentoo.org> <4C813564.7010703@emk-elektronik.de> <201009031551.04080.vapier@gentoo.org> Message-ID: <4C815B33.8000107@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 03.09.2010 21:51, Mike Frysinger wrote: > yes and no. the spi bus/cs/mode/speed is established at initialize() time, > not init(), so you'd need to store that per-instance information somewhere. > and how the discussion about netconsole handling falls out (not calling > init/halt after every transaction), this base assumption may not be valid. > -mike /* * This is the only exported function. * * It may be called several times with different bus:cs combinations. */ int enc_initialize(int bus, int cs, int speed) { enc_dev_t *enc; enc = malloc(sizeof(*enc)); if (!enc) { return -1; } memset(enc, 0, sizeof(*enc)); enc->slave = spi_setup_slave(bus, cs, speed, SPI_MODE_0); if (!enc->slave) { free(enc); return -1; } enc->netdev.init = enc_init; enc->netdev.halt = enc_halt; enc->netdev.send = enc_send; enc->netdev.recv = enc_recv; sprintf(enc->netdev.name, "enc%i.%i", bus, cs); eth_register(&(enc->netdev)); return 0; } (not compiled yet) not sure, however, if calling spi_setup_slave() is ok at this point. Reinhard