Skip to contentSkip to conversation

net: add ENC28J60 support

PATCH Applied Antony Pavlov 2 participants 4 messages Jul 1, 2014 – Jul 2, 2014 Network drivers

lore
Share & tools
lore
#0 lore raw

v3 cover net: add ENC28J60 support

Changes since RFC v2:

* drop netif_msg_*() debug level checking and packet dump;
* invoke eth_register() before enc28j60_hw_init()

    so dev_dbg() in enc28j60_hw_init() works properly;

* free allocated resources on errors in enc28j60_probe()

Antony Pavlov (2):
net.h: add ETH_ALEN constant; fix whitespaces
net: add ENC28J60 support

 drivers/net/Kconfig       |   14 +
 drivers/net/Makefile      |    1 +
 drivers/net/enc28j60.c    | 1012 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/enc28j60_hw.h |  307 ++++++++++++++
 include/net.h             |    8 +-
 5 files changed, 1339 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/enc28j60.c
 create mode 100644 drivers/net/enc28j60_hw.h
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#1 lore raw

PATCH v3 1/2 net.h: add ETH_ALEN constant; fix whitespaces

---
 include/net.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
include/net.h +5 -3
index c0f7517..364011b 100644
@@ -369,6 +369,8 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
 	return (addr[0] & addr[1] & addr[2] & addr[3] & addr[4] & addr[5]) == 0xff;
 }
 
+#define ETH_ALEN 6
+
 /**
  * random_ether_addr - Generate software assigned random Ethernet address
  * @addr: Pointer to a six-byte array containing the Ethernet address
@@ -379,9 +381,9 @@ static inline int is_broadcast_ether_addr(const u8 *addr)
 static inline void random_ether_addr(u8 *addr)
 {
 	srand(get_time_ns());
-	get_random_bytes(addr, 6);
-	addr [0] &= 0xfe;	/* clear multicast bit */
-	addr [0] |= 0x02;	/* set local assignment bit (IEEE802) */
+	get_random_bytes(addr, ETH_ALEN);
+	addr[0] &= 0xfe;	/* clear multicast bit */
+	addr[0] |= 0x02;	/* set local assignment bit (IEEE802) */
 }
 
 /**
Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#2 lore raw

PATCH v3 2/2 net: add ENC28J60 support

In reply to Antony Pavlov

ENC28J60 is a stand-alone Ethernet controller with SPI Interface and integrated 10BASE-T PHY.

This driver was ported from linux-3.15.

The most notable barebox driver version changes:
* add device tree support;
* drop netif_msg_*() debug level checking;
* use IF_ENABLED for checking CONFIG_ENC28J60_WRITEVERIFY;
* add mii_bus support.

---
 drivers/net/Kconfig       |   14 +
 drivers/net/Makefile      |    1 +
 drivers/net/enc28j60.c    | 1012 +++++++++++++++++++++++++++++++++++++++++++++
 drivers/net/enc28j60_hw.h |  307 ++++++++++++++
 4 files changed, 1334 insertions(+)
drivers/net/Kconfig +14 -0
index 7a0d5e1..5daf7ff 100644
@@ -73,6 +73,20 @@ config DRIVER_NET_DM9K
 	depends on HAS_DM9000
 	select PHYLIB
 
+config DRIVER_NET_ENC28J60
+	bool "ENC28J60 support"
+	depends on SPI
+	select PHYLIB
+	---help---
+	  Support for the Microchip EN28J60 ethernet chip.
+
+config DRIVER_NET_ENC28J60_WRITEVERIFY
+	bool "Enable write verify"
+	depends on DRIVER_NET_ENC28J60
+	---help---
+	  Enable the verify after the buffer write useful for debugging purpose.
+	  If unsure, say N.
+
 config DRIVER_NET_EP93XX
 	bool "EP93xx Ethernet driver"
 	depends on ARCH_EP93XX
drivers/net/Makefile +1 -0
index 65f0d8b..8acd2a6 100644
@@ -10,6 +10,7 @@ obj-$(CONFIG_DRIVER_NET_CPSW)		+= cpsw.o
 obj-$(CONFIG_DRIVER_NET_DAVINCI_EMAC)	+= davinci_emac.o
 obj-$(CONFIG_DRIVER_NET_DESIGNWARE)	+= designware.o
 obj-$(CONFIG_DRIVER_NET_DM9K)		+= dm9k.o
+obj-$(CONFIG_DRIVER_NET_ENC28J60)	+= enc28j60.o
 obj-$(CONFIG_DRIVER_NET_EP93XX)		+= ep93xx.o
 obj-$(CONFIG_DRIVER_NET_ETHOC)		+= ethoc.o
 obj-$(CONFIG_DRIVER_NET_FEC_IMX)	+= fec_imx.o
drivers/net/enc28j60.c new file +1012 -0

1,012 lines not on this page · raw message

drivers/net/enc28j60_hw.h new file +307 -0

307 lines not on this page · raw message

Signature · 7 lines
2.0.1


_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Applied
#3 lore raw
In reply to Antony Pavlov
Quoted 11 lines · Antony Pavlov

Changes since RFC v2:

* drop netif_msg_*() debug level checking and packet dump;
* invoke eth_register() before enc28j60_hw_init()

    so dev_dbg() in enc28j60_hw_init() works properly;

* free allocated resources on errors in enc28j60_probe()

Antony Pavlov (2):
net.h: add ETH_ALEN constant; fix whitespaces
net: add ENC28J60 support

Applied, thanks

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox