[U-Boot] [PATCH] NET: add ENC28J60 driver using SPI framework
Reinhard Meyer
u-boot at emk-elektronik.de
Fri Sep 3 22:31:47 CEST 2010
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
More information about the U-Boot
mailing list