From 8faf6a4098e12a885f0a19b98a9aeb26f0addf05 Mon Sep 17 00:00:00 2001 From: Jean-Philippe SAVE Date: Wed, 10 Oct 2012 14:24:26 +0200 Subject: cleo/linux/driver/net/arm/synop3504: adapt synchro with DMA, closes #3408 - force compiler to set dma own-bit at the end of the descriptor changes. - waiting for miu flush before using dma descriptors changed by dma. --- .../linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300.c | 3 +++ cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c | 11 ++++++++++- .../include/asm-arm/arch-spc300/.gitignore | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) (limited to 'cleopatre/linux-2.6.25.10-spc300') diff --git a/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300.c b/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300.c index 7e7bdfe231..dc7c048498 100644 --- a/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300.c +++ b/cleopatre/linux-2.6.25.10-spc300/arch/arm/mach-spc300/spc300.c @@ -74,6 +74,9 @@ static struct map_desc spc300_io_desc[] __initdata = { { IO_ADDRESS(ARM_UART2_BASE) , __phys_to_pfn(ARM_UART2_BASE) , SZ_1K , MT_DEVICE }, { IO_ADDRESS(SPI_BASE) , __phys_to_pfn(SPI_BASE) , SZ_1K , MT_DEVICE }, { IO_ADDRESS(MARIA_REGBANK_BASE) , __phys_to_pfn(MARIA_REGBANK_BASE) , SZ_4K , MT_DEVICE }, +#ifdef CONFIG_CHIP_FEATURE_MIU_CTRL + { IO_ADDRESS(AHB2MIU_BASE) , __phys_to_pfn(AHB2MIU_BASE) , SZ_1K , MT_DEVICE }, +#endif { IO_ADDRESS(ARM_GPIO_BASE) , __phys_to_pfn(ARM_GPIO_BASE) , SZ_1K , MT_DEVICE }, { IO_ADDRESS(ARM_WDT_BASE) , __phys_to_pfn(ARM_WDT_BASE) , SZ_1K , MT_DEVICE } }; diff --git a/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c b/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c index f2dd1e42d9..68f4cd2f69 100644 --- a/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c +++ b/cleopatre/linux-2.6.25.10-spc300/drivers/net/arm/synop3504.c @@ -54,6 +54,7 @@ #include #include #include +#include #include "synop3504_hw.h" #include "synop3504.h" @@ -815,6 +816,7 @@ static int synop3504_tx(struct sk_buff *skb, struct net_device *dev) tx->ring[n].addr1 = dma_map_single(NULL, skb->data, skb->len, DMA_TO_DEVICE); tx->ring[n].status.val = 0; + barrier(); tx->ring[n].status.bf.dma_own = 1; //Starting DMA transfert @@ -941,6 +943,7 @@ reuse_buffer: //Reset current descriptor status rx->ring[n].status.val = 0; + barrier (); rx->ring[n].status.bf.dma_own = 1; //Increase head pointer and check end of ring @@ -1004,10 +1007,11 @@ static void synop3504_tx_done(struct net_device *dev, enum tx_clean_buff clean) dma_unmap_single(NULL, tx->ring[n].addr1, tx->skbs[n]->len, DMA_TO_DEVICE); //Update the current buffer descriptor - tx->ring[n].status.val = 0; tx->ring[n].ctrl.val = 0; tx->ring[n].ctrl.bf.addr2en = 1; tx->ring[n].addr1 = 0; + barrier(); + tx->ring[n].status.val = 0; //Freeing skbuff dev_kfree_skb_any(tx->skbs[n]); @@ -1045,6 +1049,11 @@ static int synop3504_poll(struct napi_struct *napi, int budget) do { + //Flush AHB2MIU + AHB2MIU_FLUSH_REG_VA = AHB2MIU_BF (FLUSH_ETH1_DMA, 1); + while (AHB2MIU_BFEXT (FLUSH_ETH1_DMA, AHB2MIU_FLUSH_REG_VA)) + ; + //Get IRQ status SynopsysGetIntStatus(synop, &status); //Suppress rx, tx states and error bits (not needed in this function) diff --git a/cleopatre/linux-2.6.25.10-spc300/include/asm-arm/arch-spc300/.gitignore b/cleopatre/linux-2.6.25.10-spc300/include/asm-arm/arch-spc300/.gitignore index a2ad947475..09d2b18c3e 100644 --- a/cleopatre/linux-2.6.25.10-spc300/include/asm-arm/arch-spc300/.gitignore +++ b/cleopatre/linux-2.6.25.10-spc300/include/asm-arm/arch-spc300/.gitignore @@ -25,6 +25,7 @@ ips/timer.h ips/uart.h ips/wdt.h +ips/hardware/ahb2miu.h ips/hardware/arm_apb.h ips/hardware/arm_gpio.h ips/hardware/arm_ictl.h -- cgit v1.2.3