summaryrefslogtreecommitdiff
path: root/cleopatre/u-boot-1.1.6/drivers
diff options
context:
space:
mode:
authordraskovic2009-10-06 14:59:48 +0000
committerdraskovic2009-10-06 14:59:48 +0000
commit93760f0e337c4a5ebc1694de73d43983ebe61124 (patch)
tree8b43fbeb11cdcfcd4cb9df0d0842704370037467 /cleopatre/u-boot-1.1.6/drivers
parentb86ce980f4f800fb81513e3812a118ac5fa74f5c (diff)
[CLEO][U-BOOT] Added functions to stop D-cache in eth_init() and to re-enable it again in eth_halt().
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@5959 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cleopatre/u-boot-1.1.6/drivers')
-rw-r--r--cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c
index 4532cd5bde..2d580e6230 100644
--- a/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c
+++ b/cleopatre/u-boot-1.1.6/drivers/netspcmac_eth.c
@@ -58,6 +58,9 @@
#endif
extern void flush_dcache(void);
+extern void flush_caches(void);
+extern void dcache_disable (void);
+static dcache_switch = 0;
/* This structure is common for both receive and transmit DMA descriptors.
* A descriptor should not be used for storing more than one frame. */
@@ -772,11 +775,13 @@ static void init_dma_desc_rings (void)
PRINTK ("allocate and init the DMA RX/TX lists\n");
+#if 0
/* Clean out uncached buffers */
if ( dcache_status() != 0 )
{
flush_dcache();
}
+#endif
/* Allocate memory for the DMA RX/TX buffer descriptors */
dma_rx = (volatile spcmac_dma_des *) (&dma.desc_rx[0]);
@@ -1007,6 +1012,7 @@ int spcmac_eth_tx (volatile uchar * data, int len)
int pos;
+#if 0
/* On begining of transmission we have to provide cache coherency,
* i.e. we have ro make sure that we flush all the data from cache to memory,
* so that DMA can take valid data from the memory to send them out. */
@@ -1014,6 +1020,7 @@ int spcmac_eth_tx (volatile uchar * data, int len)
{
flush_dcache(); /* Make sure data in memory */
}
+#endif
pos = cur_tx;
p += pos;
@@ -1079,6 +1086,7 @@ void spcmac_eth_rx (void)
int frame_len = 0, pos;
volatile spcmac_dma_des *drx;
+#if 0
/* DMA brought something from network to the memory.
* We have to invalidate our D cache in order to force
* taking of "update" data from the memory. */
@@ -1086,6 +1094,7 @@ void spcmac_eth_rx (void)
{
flush_dcache(); /* Make sure data in memory */
}
+#endif
pos = cur_rx;
drx = dma_rx + pos;
@@ -1300,6 +1309,14 @@ extern int eth_init (bd_t * bd)
{
PRINTK ("%s\n", __FUNCTION__);
+ /* Disable D-cache if it is turned on */
+ if ( dcache_status() != 0 )
+ {
+ flush_dcache();
+ dcache_disable();
+ dcache_switch = 1; /* flag to notice to eth_halt to turn it on */
+ }
+
spcmac_reset_eth (bd);
return 0;
@@ -1318,6 +1335,17 @@ extern void eth_halt (void)
/* Free buffers */
free_dma_desc_resources ();
+
+ /* If D-cache was turned off by eth_init,
+ * turn it on now */
+ if ( dcache_switch == 1 )
+ {
+ /* Aways first invalidate cache and then disable it,
+ * because moment of enablig cache can be disaterous */
+ flush_dcache();
+ dcache_enable();
+ dcache_switch = 0;
+ }
}
/* Get a data block via Ethernet */