From 43c3f3e4a68c90dea0024b684ecabce78b2f3a6a Mon Sep 17 00:00:00 2001 From: Astro Date: Sun, 18 Aug 2019 22:52:05 +0200 Subject: [PATCH] eth: fix tx_clock magnitude bug Ethernet TX now works! --- src/eth/mod.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/eth/mod.rs b/src/eth/mod.rs index 08db500..ab12288 100644 --- a/src/eth/mod.rs +++ b/src/eth/mod.rs @@ -12,6 +12,8 @@ pub mod tx; pub const MTU: usize = 1536; /// Maximum MDC clock const MAX_MDC: u32 = 2_500_000; +/// Clock for GbE +const TX_1000: u32 = 125_000_000; pub struct Eth { regs: &'static mut regs::RegisterBlock, @@ -152,14 +154,14 @@ impl Eth<(), ()> { } pub fn gem0(macaddr: [u8; 6]) -> Self { - Self::setup_gem0_clock(125); + Self::setup_gem0_clock(TX_1000); let regs = regs::RegisterBlock::gem0(); Self::from_regs(regs, macaddr) } pub fn gem1(macaddr: [u8; 6]) -> Self { - Self::setup_gem1_clock(125); + Self::setup_gem1_clock(TX_1000); let regs = regs::RegisterBlock::gem1(); Self::from_regs(regs, macaddr) @@ -401,7 +403,7 @@ impl Eth { .set_restart_autoneg(true) ); // 125 MHz for 1000base-TX - Self::setup_gem0_clock(125); + Self::setup_gem0_clock(TX_1000); true }