From 6fc605be954cb33b0a59eb112975ce28e151e624 Mon Sep 17 00:00:00 2001
From: "Wesley W. Terpstra" <w.terpstra@gsi.de>
Date: Thu, 5 Jul 2012 15:12:04 +0200
Subject: [PATCH] Return to 62.5MHz; packet loss was the filter not the
 frequency. Update Etherbone config space with correct IP address.

---
 boards/arria/board.h |  2 +-
 lib/bootp.c          | 11 +++++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/boards/arria/board.h b/boards/arria/board.h
index 39b2948f6..d872ab686 100644
--- a/boards/arria/board.h
+++ b/boards/arria/board.h
@@ -6,7 +6,7 @@
 /* Board-specific parameters */
 
 /* WR Core system/CPU clock frequency in Hz */
-#define CPU_CLOCK 125000000ULL
+#define CPU_CLOCK 62500000ULL
 
 /* WR Reference clock period (picoseconds) and frequency (Hz) */
 #define REF_CLOCK_PERIOD_PS 8000
diff --git a/lib/bootp.c b/lib/bootp.c
index 53216971e..6d4578c9e 100644
--- a/lib/bootp.c
+++ b/lib/bootp.c
@@ -124,7 +124,10 @@ int send_bootp(uint8_t* buf, int retry) {
 
 int process_bootp(uint8_t* buf, int len) 
 {
+  volatile unsigned int *eb_ip = (unsigned int*)0x20718;
+  unsigned int ip;
   uint8_t mac[6];
+  
   get_mac_addr(mac);
   
   if (len != BOOTP_END) return 0;
@@ -139,5 +142,13 @@ int process_bootp(uint8_t* buf, int len)
   
   mprintf("Discovered IP address!\n");
   memcpy(myIP, buf+BOOTP_YIADDR, 4);
+  
+  ip = 
+    (buf[BOOTP_YIADDR+0] << 24) |
+    (buf[BOOTP_YIADDR+1] << 16) |
+    (buf[BOOTP_YIADDR+2] <<  8) |
+    (buf[BOOTP_YIADDR+3]);
+  while (*eb_ip != ip) *eb_ip = ip;
+  
   return 1;
 }
-- 
GitLab