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 19:50:28 +0200 [thread overview]
Message-ID: <4C813564.7010703@emk-elektronik.de> (raw)
In-Reply-To: <201008252355.22876.vapier@gentoo.org>
Dear Mike Frysinger,
> pass the bus/cs/speed/mode in to the initialize function and store it in the
> per-device state. then you can work fine with multiple enc28j60 devices in
> one board.
>
> along those lines, all of the local enc funcs should be changed to take the
> private state and operate off that instead of random global variables.
Something like this?
typedef struct enc_device {
struct eth_device netdev;
struct spi_slave *slave;
u16 next_pointer;
int rx_reset_counter;
u8 bank; /* current bank in enc28j60 */
} enc_dev_t;
#define to_enc(_nd) container_of(_nd, struct enc_device, netdev)
...
static u8 enc_r8(enc_dev_t *, u16 reg);
static u16 enc_r16(enc_dev_t *, u16 reg);
static void enc_w8(enc_dev_t *, u16 reg, u8 data);
static void enc_w16(enc_dev_t *, u16 reg, u16 data);
static void enc_w8_retry(enc_dev_t *, u16 reg, u8 data, int c);
I agree that's more perfect but kind of overkill, too;
assuming that only one enc can be active at any given time;)
Best Regards,
Reinhard
next prev parent reply other threads:[~2010-09-03 17:50 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 [this message]
2010-09-03 19:51 ` Mike Frysinger
2010-09-03 20:31 ` Reinhard Meyer
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=4C813564.7010703@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