Skip to content

Commit 8638e25

Browse files
author
Johannes Draaijer
committed
Add comment about required startup sequence
1 parent 650aa87 commit 8638e25

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/lib.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,19 @@ where
113113
RXD0: RmiiRxD0 + AlternateVeryHighSpeed,
114114
RXD1: RmiiRxD1 + AlternateVeryHighSpeed,
115115
{
116+
// Configure all of the pins correctly
116117
pins.setup_pins();
118+
119+
// Set up the clocks and reset the MAC periperhal
117120
setup::setup();
118121

122+
// Congfigure and start up the ethernet DMA.
123+
// Note: this _must_ happen before configuring the MAC.
124+
// It's not entirely clear why, but no interrupts are
125+
// generated if the order is reversed.
119126
let dma = EthernetDMA::new(eth_dma, rx_buffer, tx_buffer);
127+
128+
// Configure the ethernet MAC
120129
let mac = EthernetMAC::new(eth_mac, eth_mmc, clocks)?;
121130

122131
Ok((dma, mac))
@@ -162,10 +171,19 @@ where
162171
MDIO: mac::MdioPin,
163172
MDC: mac::MdcPin,
164173
{
174+
// Configure all of the pins correctly
165175
pins.setup_pins();
176+
177+
// Set up the clocks and reset the MAC periperhal
166178
setup::setup();
167179

180+
// Congfigure and start up the ethernet DMA.
181+
// Note: this _must_ happen before configuring the MAC.
182+
// It's not entirely clear why, but no interrupts are
183+
// generated if the order is reversed.
168184
let dma = EthernetDMA::new(eth_dma, rx_buffer, tx_buffer);
185+
186+
// Configure the ethernet MAC
169187
let mac = EthernetMAC::new(eth_mac, eth_mmc, clocks)?.with_mii(mdio, mdc);
170188

171189
Ok((dma, mac))

0 commit comments

Comments
 (0)