[PATCH] ARM: dma-mapping: highbank: Restrict DMA to 32-bit addresses

2013-08-01 Thread Andreas Herrmann

Some devices on Calxeda ECX-2000 are restricted to 32-bit DMA. Thus
the platform needs to set dma_zone_size, otherwise dma-mapping code is
complaining, e.g.

  calxedaxgmac fff5.ethernet: coherent DMA mask 0x is smaller than 
system
GFP_DMA mask 0x

Same is true for sata_highbank. For the latter dma_coherent_mask could
be increased but due to the lack of DMA32 zone we need to adapt
arm_dma_limit in general.

Signed-off-by: Andreas Herrmann 
---
 arch/arm/mach-highbank/Kconfig|1 +
 arch/arm/mach-highbank/highbank.c |3 +++
 arch/arm/mm/dma-mapping.c |4 
 3 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index cd9fcb1..efe4961 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -18,3 +18,4 @@ config ARCH_HIGHBANK
select PL320_MBOX
select SPARSE_IRQ
select USE_OF
+   select ZONE_DMA if ARM_LPAE
diff --git a/arch/arm/mach-highbank/highbank.c 
b/arch/arm/mach-highbank/highbank.c
index 8881579..31b26de 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -176,6 +176,9 @@ static const char *highbank_match[] __initconst = {
 };
 
 DT_MACHINE_START(HIGHBANK, "Highbank")
+#ifdef CONFIG_ZONE_DMA
+   .dma_zone_size  = DMA_BIT_MASK(32),
+#endif
.smp= smp_ops(highbank_smp_ops),
.init_irq   = highbank_init_irq,
.init_time  = highbank_timer_init,
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 7f9b179..f404dfc 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -651,7 +651,11 @@ static void *__dma_alloc(struct device *dev, size_t size, 
dma_addr_t *handle,
if (!mask)
return NULL;
 
+#ifdef CONFIG_ARM_LPAE
+   if (mask <= 0xULL)
+#else
if (mask < 0xULL)
+#endif
gfp |= GFP_DMA;
 
/*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: dma-mapping: highbank: Restrict DMA to 32-bit addresses

2013-08-01 Thread Russell King - ARM Linux
On Thu, Aug 01, 2013 at 10:40:47PM +0200, Andreas Herrmann wrote:
> 
> Some devices on Calxeda ECX-2000 are restricted to 32-bit DMA. Thus
> the platform needs to set dma_zone_size, otherwise dma-mapping code is
> complaining, e.g.
> 
>   calxedaxgmac fff5.ethernet: coherent DMA mask 0x is smaller 
> than system
> GFP_DMA mask 0x
> 
> Same is true for sata_highbank. For the latter dma_coherent_mask could
> be increased but due to the lack of DMA32 zone we need to adapt
> arm_dma_limit in general.

Please wait until I post my dma mask patches.  Thanks.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] ARM: dma-mapping: highbank: Restrict DMA to 32-bit addresses

2013-08-01 Thread Russell King - ARM Linux
On Thu, Aug 01, 2013 at 10:40:47PM +0200, Andreas Herrmann wrote:
 
 Some devices on Calxeda ECX-2000 are restricted to 32-bit DMA. Thus
 the platform needs to set dma_zone_size, otherwise dma-mapping code is
 complaining, e.g.
 
   calxedaxgmac fff5.ethernet: coherent DMA mask 0x is smaller 
 than system
 GFP_DMA mask 0x
 
 Same is true for sata_highbank. For the latter dma_coherent_mask could
 be increased but due to the lack of DMA32 zone we need to adapt
 arm_dma_limit in general.

Please wait until I post my dma mask patches.  Thanks.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] ARM: dma-mapping: highbank: Restrict DMA to 32-bit addresses

2013-08-01 Thread Andreas Herrmann

Some devices on Calxeda ECX-2000 are restricted to 32-bit DMA. Thus
the platform needs to set dma_zone_size, otherwise dma-mapping code is
complaining, e.g.

  calxedaxgmac fff5.ethernet: coherent DMA mask 0x is smaller than 
system
GFP_DMA mask 0x

Same is true for sata_highbank. For the latter dma_coherent_mask could
be increased but due to the lack of DMA32 zone we need to adapt
arm_dma_limit in general.

Signed-off-by: Andreas Herrmann andreas.herrm...@calxeda.com
---
 arch/arm/mach-highbank/Kconfig|1 +
 arch/arm/mach-highbank/highbank.c |3 +++
 arch/arm/mm/dma-mapping.c |4 
 3 files changed, 8 insertions(+)

diff --git a/arch/arm/mach-highbank/Kconfig b/arch/arm/mach-highbank/Kconfig
index cd9fcb1..efe4961 100644
--- a/arch/arm/mach-highbank/Kconfig
+++ b/arch/arm/mach-highbank/Kconfig
@@ -18,3 +18,4 @@ config ARCH_HIGHBANK
select PL320_MBOX
select SPARSE_IRQ
select USE_OF
+   select ZONE_DMA if ARM_LPAE
diff --git a/arch/arm/mach-highbank/highbank.c 
b/arch/arm/mach-highbank/highbank.c
index 8881579..31b26de 100644
--- a/arch/arm/mach-highbank/highbank.c
+++ b/arch/arm/mach-highbank/highbank.c
@@ -176,6 +176,9 @@ static const char *highbank_match[] __initconst = {
 };
 
 DT_MACHINE_START(HIGHBANK, Highbank)
+#ifdef CONFIG_ZONE_DMA
+   .dma_zone_size  = DMA_BIT_MASK(32),
+#endif
.smp= smp_ops(highbank_smp_ops),
.init_irq   = highbank_init_irq,
.init_time  = highbank_timer_init,
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 7f9b179..f404dfc 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -651,7 +651,11 @@ static void *__dma_alloc(struct device *dev, size_t size, 
dma_addr_t *handle,
if (!mask)
return NULL;
 
+#ifdef CONFIG_ARM_LPAE
+   if (mask = 0xULL)
+#else
if (mask  0xULL)
+#endif
gfp |= GFP_DMA;
 
/*
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/