Merge pull request #1407 from aozima/pulls

update enc28j60 driver: ensure enable PHY link changed interrupt.
This commit is contained in:
Bernard Xiong 2018-05-05 14:34:52 +08:00 committed by GitHub
commit 290b2fa98e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 230 additions and 222 deletions

View File

@ -321,6 +321,8 @@ static rt_err_t enc28j60_init(rt_device_t dev)
enc28j60_phy_write(spi_device, PHCON1, PHCON1_PDPXMD); // full duplex enc28j60_phy_write(spi_device, PHCON1, PHCON1_PDPXMD); // full duplex
// no loopback of transmitted frames // no loopback of transmitted frames
enc28j60_phy_write(spi_device, PHCON2, PHCON2_HDLDIS); enc28j60_phy_write(spi_device, PHCON2, PHCON2_HDLDIS);
/* enable PHY link changed interrupt. */
enc28j60_phy_write(spi_device, PHIE, PHIE_PGEIE | PHIE_PLNKIE);
enc28j60_set_bank(spi_device, ECON2); enc28j60_set_bank(spi_device, ECON2);
spi_write_op(spi_device, ENC28J60_BIT_FIELD_SET, ECON2, ECON2_AUTOINC); spi_write_op(spi_device, ENC28J60_BIT_FIELD_SET, ECON2, ECON2_AUTOINC);

View File

@ -221,6 +221,12 @@
#define PHCON2_TXDIS 0x2000 #define PHCON2_TXDIS 0x2000
#define PHCON2_JABBER 0x0400 #define PHCON2_JABBER 0x0400
#define PHCON2_HDLDIS 0x0100 #define PHCON2_HDLDIS 0x0100
/* ENC28J60 PHY PHIE Register Bit Definitions */
#define PHIE_PLNKIE (1 << 4)
#define PHIE_PGEIE (1 << 1)
/* ENC28J60 PHY PHIR Register Bit Definitions */
#define PHIR_PLNKIF (1 << 4)
#define PHIR_PGEIF (1 << 1)
// ENC28J60 Packet Control Byte Bit Definitions // ENC28J60 Packet Control Byte Bit Definitions
#define PKTCTRL_PHUGEEN 0x08 #define PKTCTRL_PHUGEEN 0x08