Skip to contentSkip to conversation

NET: add ENC28J60 driver using SPI framework

PATCH Superseded Reinhard Meyer 3 participants 4 messages Sep 12, 2010 – Sep 20, 2010 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 NET: add ENC28J60 driver using SPI framework

V3: further refinements:
- use priv member instead of container method
- allow setting of MAC address by write_hwaddr method
- avoid shutting down link between commands

---
 drivers/net/Makefile   |    1 +
 drivers/net/enc28j60.c |  978 ++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/enc28j60.h |  251 +++++++++++++
 include/netdev.h       |    2 +
 4 files changed, 1232 insertions(+), 0 deletions(-)
 create mode 100644 drivers/net/enc28j60.c
 create mode 100644 drivers/net/enc28j60.h
drivers/net/Makefile +1 -0
index 479954d..79eb66b 100644
@@ -39,6 +39,7 @@ COBJS-$(CONFIG_DRIVER_DM9000) += dm9000x.o
 COBJS-$(CONFIG_DNET) += dnet.o
 COBJS-$(CONFIG_E1000) += e1000.o
 COBJS-$(CONFIG_EEPRO100) += eepro100.o
+COBJS-$(CONFIG_ENC28J60) += enc28j60.o
 COBJS-$(CONFIG_ENC28J60_LPC2292) += enc28j60_lpc2292.o
 COBJS-$(CONFIG_EP93XX) += ep93xx_eth.o
 COBJS-$(CONFIG_ETHOC) += ethoc.o
drivers/net/enc28j60.c new file +978 -0

978 lines not on this page · raw message

drivers/net/enc28j60.h new file +251 -0

251 lines not on this page · raw message

include/netdev.h +2 -0
index 94eedfe..3ad16aa 100644
@@ -54,6 +54,8 @@ int designware_initialize(u32 id, ulong base_addr, u32 phy_addr);
 int dnet_eth_initialize(int id, void *regs, unsigned int phy_addr);
 int e1000_initialize(bd_t *bis);
 int eepro100_initialize(bd_t *bis);
+int enc28j60_initialize(unsigned int bus, unsigned int cs,
+	unsigned int max_hz, unsigned int mode);
 int ep93xx_eth_initialize(u8 dev_num, int base_addr);
 int ethoc_initialize(u8 dev_num, int base_addr);
 int eth_3com_initialize (bd_t * bis);
Signature · 1 line
1.5.6.5
Applied
#1 lore raw

PATCH v3 1/1 NET: add ENC28J60 driver using SPI framework

Hi Reinhard,

Quoted 7 lines · Reinhard Meyer

V3: further refinements:
- use priv member instead of container method
- allow setting of MAC address by write_hwaddr method
- avoid shutting down link between commands

---

Interesting driver... Thanks for all the hard work.

Applied to net/next.

regards,
Ben

#2 lore raw

PATCH v3 1/1 NET: add ENC28J60 driver using SPI framework

In reply to Reinhard Meyer

finally got around to testing this. seems like the init needs some work. if i power on the system (cold boot), boot Linux over the on-chip mac, and let Linux program the enc part, it works fine under Linux. then i do a software reset back into u-boot, it can use the enc fine too.

but if i cold boot u-boot and try to use the enc part, i get:
timeout waiting for CLKRDY
enabling DEBUG doesnt show any additional output though.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100920/9b324d4a/attachment.pgp

#3 lore raw

PATCH v3 1/1 NET: add ENC28J60 driver using SPI framework

Quoted 8 lines · On Monday, September 20, 2010 17:44:38 Mike Frysinger wrote:

finally got around to testing this. seems like the init needs some work. if i power on the system (cold boot), boot Linux over the on-chip mac, and let Linux program the enc part, it works fine under Linux. then i do a software reset back into u-boot, it can use the enc fine too.

but if i cold boot u-boot and try to use the enc part, i get:
timeout waiting for CLKRDY
enabling DEBUG doesnt show any additional output though.

comparing the linux and u-boot drivers leads me to this fix:

drivers/net/enc28j60.c +2 -0
@@ -632,6 +632,8 @@ static int enc_clock_wait(enc_dev_t *enc)
 {
 	uint64_t etime;
 
+	enc_bclr(enc, CTL_REG_ECON2, ENC_ECON2_PWRSV);
+
  	/* one second timeout */
 	etime = get_ticks() + get_tbclk();
 

i dont know if Ben wants to squash this change in his next tree, or do a patch on top of it ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100920/c32c16a4/attachment.pgp