net.h: add ETH_ALEN constant; fix whitespaces
Subsystems (2)
RFC v2 2/2 net: add initial ENC28J60 support
In reply to Antony PavlovENC28J60 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;
* use IF_ENABLED for checking CONFIG_ENC28J60_WRITEVERIFY;
* add mii_bus support;
* rename {nolock,locked}_regw_{read,write}() to enc28j60_*_{read,write}().
TODOs:
* receive only one packet per enc28j60_eth_rx() call.
* fix empty enc28j60_init_dev;
* add parameter for changing debug loglevel on-the-run;
* ENC28J60 supports only SPI mode 0 so we have to submit this information to the SPI controller explicitly.
Changes since v1:
* drop unused macros;
* use random_ether_addr();
* drop 'select CRC32' in Kconfig;
* drop MAC address generation in driver's code;
* rename {nolock,locked}_regw_{read,write}() to enc28j60_*_{read,write}();
* add mii_bus support.
--- drivers/net/Kconfig | 14 + drivers/net/Makefile | 1 + drivers/net/enc28j60.c | 1057 +++++++++++++++++++++++++++++++++++++++++++++ drivers/net/enc28j60_hw.h | 307 +++++++++++++ include/linux/netdevice.h | 53 +++ 5 files changed, 1432 insertions(+)
drivers/net/Kconfig +14 -0
@@ -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
@@ -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 +1057 -0
1,057 lines not on this page · raw message
drivers/net/enc28j60_hw.h new file +307 -0
307 lines not on this page · raw message
include/linux/netdevice.h new file +53 -0
53 lines not on this page · raw message
Signature · 7 lines
1.9.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
RFC v2 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
@@ -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
1.9.2 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [RFC v2 2/2] [WIP] net: add initial ENC28J60 support
In reply to Antony PavlovQuoted 29 lines · 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;
* useIF_ENABLEDfor checkingCONFIG_ENC28J60_WRITEVERIFY;
* addmii_bussupport;
* rename {nolock,locked}_regw_{read,write}() to enc28j60_*_{read,write}().TODOs:
* receive only one packet perenc28j60_eth_rx()call.
* fix emptyenc28j60_init_dev;
* add parameter for changing debug loglevel on-the-run;
* ENC28J60 supports only SPI mode 0 so we have to submit this information to the SPI controller explicitly.Signed-off-by Antony Pavlov <[email protected]>Changes since v1:
* drop unused macros;
* userandom_ether_addr();
* drop 'select CRC32' inKconfig;
* drop MAC address generation in driver's code;
* rename {nolock,locked}_regw_{read,write}() to enc28j60_*_{read,write}();
* addmii_bussupport.Signed-off-by Antony Pavlov <[email protected]>
...
include/linux/netdevice.h
Quoted 3 lines
include/linux/netdevice.h new file +0
-0
I don't really like the headerfile leaking in from Linux just to make this driver compile. Also I think such a fine grained network device debugging is not so useful for barebox. So can you drop this? Otherwise I'm fine with the driver.
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