All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/3] Fix conflicting definitions of flush_dcache
@ 2011-11-04 12:38 Stefan Kristiansson
  2011-11-04 12:38 ` [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead " Stefan Kristiansson
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Stefan Kristiansson @ 2011-11-04 12:38 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
1.7.5.4

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead of flush_dcache
  2011-11-04 12:38 [U-Boot] [PATCH 0/3] Fix conflicting definitions of flush_dcache Stefan Kristiansson
@ 2011-11-04 12:38 ` Stefan Kristiansson
  2011-11-10  9:12   ` Thomas Chou
  2012-03-30 21:58   ` Wolfgang Denk
  2011-11-04 12:38 ` [U-Boot] [PATCH 2/3] net/altera_tse: " Stefan Kristiansson
  2011-11-04 12:38 ` [U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function Stefan Kristiansson
  2 siblings, 2 replies; 9+ messages in thread
From: Stefan Kristiansson @ 2011-11-04 12:38 UTC (permalink / raw)
  To: u-boot

flush_dcache is not declared in the common.h API,
flush_dcache_range however is

Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Ben Warren <biggerbadderben@gmail.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 drivers/net/ethoc.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
index 7ac9025..cb79753 100644
--- a/drivers/net/ethoc.c
+++ b/drivers/net/ethoc.c
@@ -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);
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] net/altera_tse: use flush_dcache_range instead of flush_dcache
  2011-11-04 12:38 [U-Boot] [PATCH 0/3] Fix conflicting definitions of flush_dcache Stefan Kristiansson
  2011-11-04 12:38 ` [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead " Stefan Kristiansson
@ 2011-11-04 12:38 ` Stefan Kristiansson
  2011-11-10  9:14   ` Thomas Chou
  2012-03-30 21:58   ` Wolfgang Denk
  2011-11-04 12:38 ` [U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function Stefan Kristiansson
  2 siblings, 2 replies; 9+ messages in thread
From: Stefan Kristiansson @ 2011-11-04 12:38 UTC (permalink / raw)
  To: u-boot

flush_dcache is not declared in the common.h API,
flush_dcache_range however is

Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Ben Warren <biggerbadderben@gmail.com>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 drivers/net/altera_tse.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
index 5b00717..0e6aac7 100644
--- a/drivers/net/altera_tse.c
+++ b/drivers/net/altera_tse.c
@@ -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],
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function
  2011-11-04 12:38 [U-Boot] [PATCH 0/3] Fix conflicting definitions of flush_dcache Stefan Kristiansson
  2011-11-04 12:38 ` [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead " Stefan Kristiansson
  2011-11-04 12:38 ` [U-Boot] [PATCH 2/3] net/altera_tse: " Stefan Kristiansson
@ 2011-11-04 12:38 ` Stefan Kristiansson
  2011-11-10  9:10   ` Thomas Chou
  2 siblings, 1 reply; 9+ messages in thread
From: Stefan Kristiansson @ 2011-11-04 12:38 UTC (permalink / raw)
  To: u-boot

exposes functionality to flush dcache according to
the common.h API

Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
Cc: Thomas Chou <thomas@wytron.com.tw>
---
 arch/nios2/lib/cache.S |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/arch/nios2/lib/cache.S b/arch/nios2/lib/cache.S
index ee3b4b7..b952d0c 100644
--- a/arch/nios2/lib/cache.S
+++ b/arch/nios2/lib/cache.S
@@ -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:
-- 
1.7.5.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function
  2011-11-04 12:38 ` [U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function Stefan Kristiansson
@ 2011-11-10  9:10   ` Thomas Chou
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Chou @ 2011-11-10  9:10 UTC (permalink / raw)
  To: u-boot

On 11/04/2011 08:38 PM, Stefan Kristiansson wrote:
> exposes functionality to flush dcache according to
> the common.h API
>
> Signed-off-by: Stefan Kristiansson<stefan.kristiansson@saunalahti.fi>
> Cc: Thomas Chou<thomas@wytron.com.tw>
> ---
>   arch/nios2/lib/cache.S |   10 ++++++++++
>   1 files changed, 10 insertions(+), 0 deletions(-)
>

Hi Stefan,

Applied to nios next branch. Thanks.

Best regards,
Thomas


> diff --git a/arch/nios2/lib/cache.S b/arch/nios2/lib/cache.S
> index ee3b4b7..b952d0c 100644
> --- a/arch/nios2/lib/cache.S
> +++ b/arch/nios2/lib/cache.S
> @@ -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:

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead of flush_dcache
  2011-11-04 12:38 ` [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead " Stefan Kristiansson
@ 2011-11-10  9:12   ` Thomas Chou
  2012-03-30 21:58   ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Chou @ 2011-11-10  9:12 UTC (permalink / raw)
  To: u-boot

On 11/04/2011 08:38 PM, Stefan Kristiansson wrote:
> flush_dcache is not declared in the common.h API,
> flush_dcache_range however is
>
> Signed-off-by: Stefan Kristiansson<stefan.kristiansson@saunalahti.fi>
> Cc: Ben Warren<biggerbadderben@gmail.com>
> Cc: Thomas Chou<thomas@wytron.com.tw>
> ---
>   drivers/net/ethoc.c |    6 +++---
>   1 files changed, 3 insertions(+), 3 deletions(-)

Acked-by: Thomas Chou <thomas@wytron.com.tw>

>
> diff --git a/drivers/net/ethoc.c b/drivers/net/ethoc.c
> index 7ac9025..cb79753 100644
> --- a/drivers/net/ethoc.c
> +++ b/drivers/net/ethoc.c
> @@ -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);

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] net/altera_tse: use flush_dcache_range instead of flush_dcache
  2011-11-04 12:38 ` [U-Boot] [PATCH 2/3] net/altera_tse: " Stefan Kristiansson
@ 2011-11-10  9:14   ` Thomas Chou
  2012-03-30 21:58   ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Chou @ 2011-11-10  9:14 UTC (permalink / raw)
  To: u-boot

On 11/04/2011 08:38 PM, Stefan Kristiansson wrote:
> flush_dcache is not declared in the common.h API,
> flush_dcache_range however is
>
> Signed-off-by: Stefan Kristiansson<stefan.kristiansson@saunalahti.fi>
> Cc: Ben Warren<biggerbadderben@gmail.com>
> Cc: Thomas Chou<thomas@wytron.com.tw>
> ---
>   drivers/net/altera_tse.c |    9 ++++++---
>   1 files changed, 6 insertions(+), 3 deletions(-)

Acked-by: Thomas Chou <thomas@wytron.com.tw>

>
> diff --git a/drivers/net/altera_tse.c b/drivers/net/altera_tse.c
> index 5b00717..0e6aac7 100644
> --- a/drivers/net/altera_tse.c
> +++ b/drivers/net/altera_tse.c
> @@ -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],

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead of flush_dcache
  2011-11-04 12:38 ` [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead " Stefan Kristiansson
  2011-11-10  9:12   ` Thomas Chou
@ 2012-03-30 21:58   ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2012-03-30 21:58 UTC (permalink / raw)
  To: u-boot

Dear Stefan Kristiansson,

In message <1320410288-15008-2-git-send-email-stefan.kristiansson@saunalahti.fi> you wrote:
> flush_dcache is not declared in the common.h API,
> flush_dcache_range however is
> 
> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> Cc: Ben Warren <biggerbadderben@gmail.com>
> Cc: Thomas Chou <thomas@wytron.com.tw>
> ---
>  drivers/net/ethoc.c |    6 +++---
>  1 files changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
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.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/3] net/altera_tse: use flush_dcache_range instead of flush_dcache
  2011-11-04 12:38 ` [U-Boot] [PATCH 2/3] net/altera_tse: " Stefan Kristiansson
  2011-11-10  9:14   ` Thomas Chou
@ 2012-03-30 21:58   ` Wolfgang Denk
  1 sibling, 0 replies; 9+ messages in thread
From: Wolfgang Denk @ 2012-03-30 21:58 UTC (permalink / raw)
  To: u-boot

Dear Stefan Kristiansson,

In message <1320410288-15008-3-git-send-email-stefan.kristiansson@saunalahti.fi> you wrote:
> flush_dcache is not declared in the common.h API,
> flush_dcache_range however is
> 
> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> Cc: Ben Warren <biggerbadderben@gmail.com>
> Cc: Thomas Chou <thomas@wytron.com.tw>
> ---
>  drivers/net/altera_tse.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2012-03-30 21:58 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-04 12:38 [U-Boot] [PATCH 0/3] Fix conflicting definitions of flush_dcache Stefan Kristiansson
2011-11-04 12:38 ` [U-Boot] [PATCH 1/3] net/ethoc: use flush_dcache_range instead " Stefan Kristiansson
2011-11-10  9:12   ` Thomas Chou
2012-03-30 21:58   ` Wolfgang Denk
2011-11-04 12:38 ` [U-Boot] [PATCH 2/3] net/altera_tse: " Stefan Kristiansson
2011-11-10  9:14   ` Thomas Chou
2012-03-30 21:58   ` Wolfgang Denk
2011-11-04 12:38 ` [U-Boot] [PATCH 3/3] nios2: add flush_dcache_range function Stefan Kristiansson
2011-11-10  9:10   ` Thomas Chou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.