Commit Graph

15 Commits

Author SHA1 Message Date
Benoît Thébaudeau
b4c32954a6 enc28j60: Fix workaround for erratum #14
Only odd addresses may be programmed to the ERXRDPT registers, so
initialize them to RX_BUF_END instead of RX_BUF_START.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:15 +02:00
Benoît Thébaudeau
8615b77da0 enc28j60: Print the status vector in case of transmit error
This makes debugging easier.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:15 +02:00
Benoît Thébaudeau
8c6e3e348a enc28j60: Program ETXND after the data packet
Just follow the steps from the data sheet to transmit a packet.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:15 +02:00
Benoît Thébaudeau
15d1b177d6 enc28j60: Use hardware padding for transmissions
There is no reason to use software when a feature is available in
hardware.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:15 +02:00
Benoît Thébaudeau
2cd3eaf310 enc28j60: Implement and use the BFS and BFC commands
The Bit Field Set and Bit Field Clear commands are more efficient than
the Read Control Register + Write Control Register combination, so use
them whenever possible, i.e. for the ETH registers.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:15 +02:00
Benoît Thébaudeau
356d17737c enc28j60: ERXFCON needs to be set only once
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:14 +02:00
Benoît Thébaudeau
8a20e7c05c enc28j60: Fix the MAC address configuration comment
The MAADRx register numbering was wrong.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:14 +02:00
Benoît Thébaudeau
31e0c87a6f enc28j60: Do not initialize MAIPGH for full duplex
MAIPGH should be programmed only if half duplex is used.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:14 +02:00
Benoît Thébaudeau
121b066f04 enc28j60: Update the MACON4 configuration comment
This only applies to half duplex, so the actual configuration of MACON4
does not need to be changed.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:14 +02:00
Benoît Thébaudeau
2b08c32528 enc28j60: The MACON2 register is reserved
The register 0x01 in bank 2, named MACON2 in the code, is actually
reserved, so its contents must not be changed.

This register has been marked as reserved from the revision B of the
data sheet in July 2006. The current revision of the data sheet is E,
and it is quite clear about this register.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:14 +02:00
Benoît Thébaudeau
b21da96e67 enc28j60: Print revision during initialization
This is useful as debug information since the revisions of this device
have notable differences.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:14 +02:00
Benoît Thébaudeau
ba6a0bc381 enc28j60: Add workaround for erratum #2 "CLKRDY set early"
A delay of 1 ms must be added after the System Reset Command. Still wait
for ESTAT.CLKRDY afterwards as a precaution.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:13 +02:00
Benoît Thébaudeau
48f269e4f5 enc28j60: Fix RCR command for MAC and MII registers
The Read Control Register command requires that a dummy byte be read
before the register value for the MAC and MII registers.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:13 +02:00
Benoît Thébaudeau
35544e81ee enc28j60: Reuse read/writedata() for read/writedatabyte()
The read/writedatabyte() functions are just a special case of
read/writedata() with a simpler API, so reuse these instead of
duplicating code.

Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau.dev@gmail.com>
2015-07-16 21:14:13 +02:00
Adam Dunkels
bf7e191ef3 ENC28j60 Ethernet driver code 2014-06-12 00:03:44 +02:00