Fix conflicting definitions of flush_dcache
Subsystems (2)
cover Fix conflicting definitions of flush_dcache
nios2 and a couple of network drivers have been using
a non defined API to flush the data cache (flush_dcache(ulong, ulong)), this is problematic since it conflicts with other architectures definitions of flush_dcache.
This series cleans that up by letting the two network drivers use the defined flush_dcache_range(ulong, ulong) API.
It also adds this function to the nios2 architecture to avoid breakage.
Stefan Kristiansson (3):
net/ethoc: use flush_dcache_range instead of flush_dcache net/altera_tse: use flush_dcache_range instead of flush_dcache
nios2: add flush_dcache_range function
arch/nios2/lib/cache.S | 10 ++++++++++ drivers/net/altera_tse.c | 9 ++++++--- drivers/net/ethoc.c | 6 +++--- 3 files changed, 19 insertions(+), 6 deletions(-)
Signature · 1 line
1.7.5.4
PATCH 1/3 net/ethoc: use flush_dcache_range instead of flush_dcache
flush_dcache is not declared in the common.h API,flush_dcache_range however is
--- drivers/net/ethoc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethoc.c +3 -3
@@ -272,7 +272,7 @@ static int ethoc_init_ring(struct eth_device *dev)if (i == priv->num_rx -1 ) bd.stat |=RX_BD_WRAP ; -flush_dcache (bd.addr,PKTSIZE_ALIGN ); +flush_dcache_range (bd.addr, bd.addr +PKTSIZE_ALIGN );ethoc_write_bd (dev, priv->num_tx + i, &bd); }
@@ -377,7 +377,7 @@ static int ethoc_rx(struct eth_device *dev, int limit) }/* clear the buffer descriptor so it can be reused */ -flush_dcache (bd.addr,PKTSIZE_ALIGN ); +flush_dcache_range (bd.addr, bd.addr +PKTSIZE_ALIGN ); bd.stat &= ~RX_BD_STATS ; bd.stat |=RX_BD_EMPTY ;ethoc_write_bd (dev, entry, &bd);
@@ -431,7 +431,7 @@ static int ethoc_send(struct eth_device *dev, volatile void *packet, int length) bd.stat &= ~TX_BD_PAD ; bd.addr = (u32 )packet; -flush_dcache (bd.addr, length); +flush_dcache_range (bd.addr, bd.addr + length); bd.stat &= ~(TX_BD_STATS |TX_BD_LEN_MASK ); bd.stat |=TX_BD_LEN (length);ethoc_write_bd (dev, entry, &bd);
Signature · 1 line
1.7.5.4
PATCH 1/3 net/ethoc: use flush_dcache_range instead of flush_dcache
Quoted 9 lines · Stefan Kristiansson
flush_dcacheis not declared in thecommon.hAPI,flush_dcache_rangehowever isSigned-off-by Stefan Kristiansson<[email protected]>Cc Ben Warren<[email protected]>Cc Thomas Chou<[email protected]>--- drivers/net/ethoc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Quoted 32 lines
drivers/net/ethoc.c +3
-3@@ -272,7 +272,7 @@ static int ethoc_init_ring(struct eth_device *dev)if (i == priv->num_rx -1 ) bd.stat |=RX_BD_WRAP ; -flush_dcache (bd.addr,PKTSIZE_ALIGN ); +flush_dcache_range (bd.addr, bd.addr +PKTSIZE_ALIGN );ethoc_write_bd (dev, priv->num_tx + i,&bd); }@@ -377,7 +377,7 @@ static int ethoc_rx(struct eth_device *dev, int limit) }/* clear the buffer descriptor so it can be reused */ -flush_dcache (bd.addr,PKTSIZE_ALIGN ); +flush_dcache_range (bd.addr, bd.addr +PKTSIZE_ALIGN ); bd.stat&= ~RX_BD_STATS ; bd.stat |=RX_BD_EMPTY ;ethoc_write_bd (dev, entry,&bd);@@ -431,7 +431,7 @@ static int ethoc_send(struct eth_device *dev, volatile void *packet, int length) bd.stat&= ~TX_BD_PAD ; bd.addr = (u32 )packet; -flush_dcache (bd.addr, length); +flush_dcache_range (bd.addr, bd.addr + length); bd.stat&= ~(TX_BD_STATS |TX_BD_LEN_MASK ); bd.stat |=TX_BD_LEN (length);ethoc_write_bd (dev, entry,&bd);
Wolfgang Denk
AppliedPATCH 1/3 net/ethoc: use flush_dcache_range instead of flush_dcache
In reply to Stefan KristianssonDear Stefan Kristiansson,
Quoted 9 lines · In message <1320410288-15008-2-git-send-email-stefan.kristiansson@saunalahti.fi…
flush_dcacheis not declared in thecommon.hAPI,flush_dcache_rangehowever isSigned-off-by Stefan Kristiansson <[email protected]>Cc Ben Warren <[email protected]>Cc Thomas Chou <[email protected]>--- drivers/net/ethoc.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 4 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Human beings were created by water to transport it uphill.
PATCH 2/3 net/altera_tse: use flush_dcache_range instead of flush_dcache
In reply to Stefan Kristianssonflush_dcache is not declared in the common.h API,flush_dcache_range however is
--- drivers/net/altera_tse.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
drivers/net/altera_tse.c +6 -3
@@ -268,7 +268,8 @@ static int tse_eth_send(struct eth_device *dev,volatile struct alt_sgdma_descriptor *tx_desc_cur = (volatile struct alt_sgdma_descriptor *)&tx_desc[0 ]; -flush_dcache ((unsigned long )packet, length); +flush_dcache_range ((unsigned long )packet, + (unsigned long )packet + length); alt_sgdma_construct_descriptor_burst( (volatile struct alt_sgdma_descriptor *)&tx_desc[0], (volatile struct alt_sgdma_descriptor *)&tx_desc[1],
@@ -306,7 +307,8 @@ static int tse_eth_rx(struct eth_device *dev)NetReceive (NetRxPackets[0 ], packet_length);/* start descriptor again */ -flush_dcache ((unsigned long )(NetRxPackets[0 ]),PKTSIZE_ALIGN ); +flush_dcache_range ((unsigned long )(NetRxPackets[0 ]), + (unsigned long )(NetRxPackets[0 ]) +PKTSIZE_ALIGN ); alt_sgdma_construct_descriptor_burst( (volatile struct alt_sgdma_descriptor *)&rx_desc[0], (volatile struct alt_sgdma_descriptor *)&rx_desc[1],
@@ -834,7 +836,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)0x0 /* channel */ );debug ("Configuring rx desc\n" ); -flush_dcache ((unsigned long )(NetRxPackets[0 ]),PKTSIZE_ALIGN ); +flush_dcache_range ((unsigned long )(NetRxPackets[0 ]), + (unsigned long )(NetRxPackets[0 ]) +PKTSIZE_ALIGN ); alt_sgdma_construct_descriptor_burst( (volatile struct alt_sgdma_descriptor *)&rx_desc[0], (volatile struct alt_sgdma_descriptor *)&rx_desc[1],
Signature · 1 line
1.7.5.4
PATCH 2/3 net/altera_tse: use flush_dcache_range instead of flush_dcache
Quoted 9 lines · Stefan Kristiansson
flush_dcacheis not declared in thecommon.hAPI,flush_dcache_rangehowever isSigned-off-by Stefan Kristiansson<[email protected]>Cc Ben Warren<[email protected]>Cc Thomas Chou<[email protected]>--- drivers/net/altera_tse.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
Quoted 35 lines
drivers/net/altera_tse.c +6
-3@@ -268,7 +268,8 @@ static int tse_eth_send(struct eth_device *dev,volatile struct alt_sgdma_descriptor *tx_desc_cur = (volatile struct alt_sgdma_descriptor *)&tx_desc[0 ]; -flush_dcache ((unsigned long )packet, length); +flush_dcache_range ((unsigned long )packet, + (unsigned long )packet + length); alt_sgdma_construct_descriptor_burst( (volatile struct alt_sgdma_descriptor *)&tx_desc[0], (volatile struct alt_sgdma_descriptor *)&tx_desc[1],@@ -306,7 +307,8 @@ static int tse_eth_rx(struct eth_device *dev)NetReceive (NetRxPackets[0 ], packet_length);/* start descriptor again */ -flush_dcache ((unsigned long )(NetRxPackets[0 ]),PKTSIZE_ALIGN ); +flush_dcache_range ((unsigned long )(NetRxPackets[0 ]), + (unsigned long )(NetRxPackets[0 ]) +PKTSIZE_ALIGN ); alt_sgdma_construct_descriptor_burst( (volatile struct alt_sgdma_descriptor *)&rx_desc[0], (volatile struct alt_sgdma_descriptor *)&rx_desc[1],@@ -834,7 +836,8 @@ static int tse_eth_init(struct eth_device *dev, bd_t * bd)0x0 /* channel */ );debug ("Configuring rx desc\n" ); -flush_dcache ((unsigned long )(NetRxPackets[0 ]),PKTSIZE_ALIGN ); +flush_dcache_range ((unsigned long )(NetRxPackets[0 ]), + (unsigned long )(NetRxPackets[0 ]) +PKTSIZE_ALIGN ); alt_sgdma_construct_descriptor_burst( (volatile struct alt_sgdma_descriptor *)&rx_desc[0], (volatile struct alt_sgdma_descriptor *)&rx_desc[1],
Wolfgang Denk
AppliedPATCH 2/3 net/altera_tse: use flush_dcache_range instead of flush_dcache
In reply to Stefan KristianssonDear Stefan Kristiansson,
Quoted 9 lines · In message <1320410288-15008-3-git-send-email-stefan.kristiansson@saunalahti.fi…
flush_dcacheis not declared in thecommon.hAPI,flush_dcache_rangehowever isSigned-off-by Stefan Kristiansson <[email protected]>Cc Ben Warren <[email protected]>Cc Thomas Chou <[email protected]>--- drivers/net/altera_tse.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 5 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "Now here's something you're really going to like!" - Rocket J. Squirrel
PATCH 3/3 nios2: add flush_dcache_range function
In reply to Stefan Kristianssonexposes functionality to flush dcache according to the common.h API
--- arch/nios2/lib/cache.S | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
arch/nios2/lib/cache.S +10 -0
@@ -48,6 +48,16 @@ flush_icache: bltu r4, r5, 1b ret + .global flush_dcache_range + +flush_dcache_range: + movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE) + ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE) +0: flushd 0(r4) + add r4, r4, r8 + bltu r4, r5, 0b + ret + .global flush_cache flush_cache:
Signature · 1 line
1.7.5.4
Thomas Chou
AppliedPATCH 3/3 nios2: add flush_dcache_range function
Quoted 9 lines · Stefan Kristiansson
exposes functionality to flush dcache according to the
common.hAPISigned-off-by Stefan Kristiansson<[email protected]>Cc Thomas Chou<[email protected]>--- arch/nios2/lib/cache.S | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
Hi Stefan,
Applied to nios next branch. Thanks.
Best regards,
Thomas
Quoted 21 lines
arch/nios2/lib/cache.S +10
-0@@ -48,6 +48,16 @@ flush_icache: bltu r4, r5, 1b ret + .global flush_dcache_range + +flush_dcache_range: + movhi r8, %hi(CONFIG_SYS_DCACHELINE_SIZE) + ori r8, r8, %lo(CONFIG_SYS_DCACHELINE_SIZE) +0: flushd 0(r4) + add r4, r4, r8 + bltu r4, r5, 0b + ret + .global flush_cache flush_cache: