Skip to content

Commit

Permalink
stmmac: fix Transmit FIFO flush operation
Browse files Browse the repository at this point in the history
Fix the Transmit FIFO flush operation; it was
disabled while reworking the descriptor structures.

Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Giuseppe CAVALLARO authored and David S. Miller committed Apr 14, 2010
1 parent 56b106a commit 688911c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 13 deletions.
1 change: 1 addition & 0 deletions drivers/net/stmmac/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,3 +244,4 @@ extern void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6],
unsigned int high, unsigned int low);
extern void stmmac_get_mac_addr(unsigned long ioaddr, unsigned char *addr,
unsigned int high, unsigned int low);
extern void dwmac_dma_flush_tx_fifo(unsigned long ioaddr);
1 change: 0 additions & 1 deletion drivers/net/stmmac/dwmac1000.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,6 @@ enum rfd {
deac_full_minus_4 = 0x00401800,
};
#define DMA_CONTROL_TSF 0x00200000 /* Transmit Store and Forward */
#define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */

enum ttc_control {
DMA_CONTROL_TTC_64 = 0x00000000,
Expand Down
9 changes: 0 additions & 9 deletions drivers/net/stmmac/dwmac1000_dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,6 @@ static int dwmac1000_dma_init(unsigned long ioaddr, int pbl, u32 dma_tx,
return 0;
}

/* Transmit FIFO flush operation */
static void dwmac1000_flush_tx_fifo(unsigned long ioaddr)
{
u32 csr6 = readl(ioaddr + DMA_CONTROL);
writel((csr6 | DMA_CONTROL_FTF), ioaddr + DMA_CONTROL);

do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF));
}

static void dwmac1000_dma_operation_mode(unsigned long ioaddr, int txmode,
int rxmode)
{
Expand Down
1 change: 1 addition & 0 deletions drivers/net/stmmac/dwmac_dma.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
#define DMA_STATUS_TU 0x00000004 /* Transmit Buffer Unavailable */
#define DMA_STATUS_TPS 0x00000002 /* Transmit Process Stopped */
#define DMA_STATUS_TI 0x00000001 /* Transmit Interrupt */
#define DMA_CONTROL_FTF 0x00100000 /* Flush transmit FIFO */

extern void dwmac_enable_dma_transmission(unsigned long ioaddr);
extern void dwmac_enable_dma_irq(unsigned long ioaddr);
Expand Down
7 changes: 7 additions & 0 deletions drivers/net/stmmac/dwmac_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,13 @@ int dwmac_dma_interrupt(unsigned long ioaddr,
return ret;
}

void dwmac_dma_flush_tx_fifo(unsigned long ioaddr)
{
u32 csr6 = readl(ioaddr + DMA_CONTROL);
writel((csr6 | DMA_CONTROL_FTF), ioaddr + DMA_CONTROL);

do {} while ((readl(ioaddr + DMA_CONTROL) & DMA_CONTROL_FTF));
}

void stmmac_set_mac_addr(unsigned long ioaddr, u8 addr[6],
unsigned int high, unsigned int low)
Expand Down
6 changes: 3 additions & 3 deletions drivers/net/stmmac/enh_desc.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x,
if (unlikely(p->des01.etx.frame_flushed)) {
CHIP_DBG(KERN_ERR "\tframe_flushed error\n");
x->tx_frame_flushed++;
/*enh_desc_flush_tx_fifo(ioaddr);*/
dwmac_dma_flush_tx_fifo(ioaddr);
}

if (unlikely(p->des01.etx.loss_carrier)) {
Expand Down Expand Up @@ -68,7 +68,7 @@ static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x,

if (unlikely(p->des01.etx.underflow_error)) {
CHIP_DBG(KERN_ERR "\tunderflow error\n");
/*enh_desc_flush_tx_fifo(ioaddr);*/
dwmac_dma_flush_tx_fifo(ioaddr);
x->tx_underflow++;
}

Expand All @@ -80,7 +80,7 @@ static int enh_desc_get_tx_status(void *data, struct stmmac_extra_stats *x,
if (unlikely(p->des01.etx.payload_error)) {
CHIP_DBG(KERN_ERR "\tAddr/Payload csum error\n");
x->tx_payload_error++;
/*enh_desc_flush_tx_fifo(ioaddr);*/
dwmac_dma_flush_tx_fifo(ioaddr);
}

ret = -1;
Expand Down

0 comments on commit 688911c

Please sign in to comment.