Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

BIOS: reset ethernet PHY a second time

  • Loading branch information...
commit 46d2c61d5d1b67dc73f79b3821904ce6748ab3e9 1 parent f4d446a
@sbourdeauducq sbourdeauducq authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 software/bios/main.c
View
18 software/bios/main.c
@@ -31,6 +31,7 @@
#include <hw/sysctl.h>
#include <hw/gpio.h>
#include <hw/flash.h>
+#include <hw/minimac.h>
#include <hal/vga.h>
#include <hal/tmu.h>
@@ -592,6 +593,22 @@ static void readstr(char *s, int size)
}
}
+static void ethreset_delay()
+{
+ CSR_TIMER0_COUNTER = 0;
+ CSR_TIMER0_COMPARE = brd_desc->clk_frequency >> 2;
+ CSR_TIMER0_CONTROL = TIMER_ENABLE;
+ while(CSR_TIMER0_CONTROL & TIMER_ENABLE);
+}
+
+static void ethreset()
+{
+ CSR_MINIMAC_SETUP = MINIMAC_SETUP_PHYRST;
+ ethreset_delay();
+ CSR_MINIMAC_SETUP = 0;
+ ethreset_delay();
+}
+
int main(int i, char **c)
{
char buffer[64];
@@ -614,6 +631,7 @@ int main(int i, char **c)
printf("I: Booting in rescue mode\n");
splash_display();
+ ethreset(); /* < that pesky ethernet PHY needs two resets at times... */
print_mac();
boot_sequence();
vga_unblank();
Please sign in to comment.
Something went wrong with that request. Please try again.