public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Reinhard Meyer <u-boot@emk-elektronik.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] NET: add ENC28J60 driver using SPI framework
Date: Fri, 03 Sep 2010 22:31:47 +0200	[thread overview]
Message-ID: <4C815B33.8000107@emk-elektronik.de> (raw)
In-Reply-To: <201009031551.04080.vapier@gentoo.org>

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

  reply	other threads:[~2010-09-03 20:31 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-25 12:47 [U-Boot] [PATCH] NET: add ENC28J60 driver using SPI framework Reinhard Meyer
2010-08-26  3:55 ` Mike Frysinger
2010-08-26  6:19   ` Reinhard Meyer
2010-08-26  6:32     ` Mike Frysinger
2010-08-26  6:41       ` Reinhard Meyer
2010-08-26  7:11         ` Mike Frysinger
2010-09-03 17:50   ` Reinhard Meyer
2010-09-03 19:51     ` Mike Frysinger
2010-09-03 20:31       ` Reinhard Meyer [this message]
2010-09-03 21:03         ` Mike Frysinger
2010-09-03 21:23           ` Reinhard Meyer
2010-09-03 22:14             ` Mike Frysinger
2010-09-04  3:25               ` Reinhard Meyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C815B33.8000107@emk-elektronik.de \
    --to=u-boot@emk-elektronik.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox