1
0
Эх сурвалжийг харах

update enc28j60 driver: ensure enable PHY link changed interrupt.

aozima 7 жил өмнө
parent
commit
088990f7d3

+ 2 - 0
components/drivers/spi/enc28j60.c

@@ -321,6 +321,8 @@ static rt_err_t enc28j60_init(rt_device_t dev)
     enc28j60_phy_write(spi_device, PHCON1, PHCON1_PDPXMD); // full duplex
     // no loopback of transmitted frames
     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);
     spi_write_op(spi_device, ENC28J60_BIT_FIELD_SET, ECON2, ECON2_AUTOINC);

+ 6 - 0
components/drivers/spi/enc28j60.h

@@ -221,6 +221,12 @@
 #define PHCON2_TXDIS        0x2000
 #define PHCON2_JABBER       0x0400
 #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
 #define PKTCTRL_PHUGEEN     0x08