Skip to content

Commit

Permalink
Ethernet: workaround for permanent RX FIFO overflow bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastien Bourdeauducq committed Apr 7, 2011
1 parent 26fba40 commit d8ddaca
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 9 deletions.
6 changes: 3 additions & 3 deletions boards/milkymist-one/rtl/system.v
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ always @(posedge sys_clk) begin
end

assign ac97_rst_n = ~sys_rst;
assign phy_rst_n = ~sys_rst;
assign videoin_rst_n = ~sys_rst;

/*
Expand Down Expand Up @@ -896,7 +895,7 @@ sysctl #(
.csr_addr(4'h1),
.ninputs(7),
.noutputs(2),
.systemid(32'h10034D31) /* 1.0.0 RC3 on M1 */
.systemid(32'h10044D31) /* 1.0.0 RC4 on M1 */
) sysctl (
.sys_clk(sys_clk),
.sys_rst(sys_rst),
Expand Down Expand Up @@ -1279,7 +1278,8 @@ minimac #(
.phy_col(phy_col),
.phy_crs(phy_crs),
.phy_mii_clk(phy_mii_clk),
.phy_mii_data(phy_mii_data)
.phy_mii_data(phy_mii_data),
.phy_rst_n(phy_rst_n)
);
`else
assign csr_dr_ethernet = 32'd0;
Expand Down
7 changes: 5 additions & 2 deletions cores/minimac/rtl/minimac.v
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -56,7 +56,8 @@ module minimac #(
input phy_col,
input phy_crs,
output phy_mii_clk,
inout phy_mii_data
inout phy_mii_data,
output phy_rst_n
);

assign wbrx_cti_o = 3'd0;
Expand Down Expand Up @@ -112,6 +113,8 @@ minimac_ctlif #(
.phy_mii_data(phy_mii_data)
);

assign phy_rst_n = ~(rx_rst & tx_rst);

minimac_rx rx(
.sys_clk(sys_clk),
.sys_rst(sys_rst),
Expand Down
2 changes: 1 addition & 1 deletion software/include/base/version.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef __VERSION_H
#define __VERSION_H

#define VERSION "1.0RC3"
#define VERSION "1.0RC4"

#endif /* __VERSION_H */
24 changes: 21 additions & 3 deletions software/libnet/microudp.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Milkymist VJ SoC (Software)
* Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -400,13 +400,31 @@ void microudp_start(unsigned char *macaddr, unsigned int ip, void *buffers)
CSR_MINIMAC_SETUP = 0;
}

static void ethernet_reset()
{
int i;

printf("Resetting PHY\n");
CSR_MINIMAC_SETUP = MINIMAC_SETUP_RXRST|MINIMAC_SETUP_TXRST;
for(i=0;i<8000;i++)
__asm__("nop");
CSR_MINIMAC_SETUP = 0;
}

void microudp_service()
{
static int previous_overflow;

if(irq_pending() & IRQ_ETHRX) {
if(CSR_MINIMAC_SETUP & MINIMAC_SETUP_RXRST) {
printf("Minimac RX FIFO overflow!\n");
CSR_MINIMAC_SETUP = 0;
}
if(previous_overflow)
ethernet_reset();
else
CSR_MINIMAC_SETUP = 0;
previous_overflow = 1;
} else
previous_overflow = 0;
if(CSR_MINIMAC_STATE0 == MINIMAC_STATE_PENDING) {
rxlen = CSR_MINIMAC_COUNT0;
rxbuffer = rxbuffer0;
Expand Down

0 comments on commit d8ddaca

Please sign in to comment.