All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Fix IXP4xx coherent allocations
@ 2013-03-23 19:35 ` Krzysztof Halasa
  0 siblings, 0 replies; 20+ messages in thread
From: Krzysztof Halasa @ 2013-03-23 19:35 UTC (permalink / raw)
  To: netdev, linux-arm-kernel, linux-kernel, Christophe Aeschlimann,
	David Miller

ARM core code currently requires coherent DMA mask to be set. Make sure
we limit PCI devices to 64 MiB while allowing on-chip devices to access
the whole 4 GiB address space.

This fixes a v3.7+ regression which broke IXP4xx built-in network devices.

Signed-off-by: Krzysztof Hałasa <khc@pm.waw.pl>
Cc: <stable@vger.kernel.org>

diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index ea1933d..8629fc9 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -454,10 +454,15 @@ int ixp4xx_setup(int nr, struct pci_sys_data *sys)
 
 int dma_set_coherent_mask(struct device *dev, u64 mask)
 {
-	if (mask >= SZ_64M - 1)
-		return 0;
+	if ((mask & DMA_BIT_MASK(26)) != DMA_BIT_MASK(26))
+		return -EIO;
+
+	/* PCI devices are limited to 64 MiB */
+	if (dev_is_pci(dev))
+		mask &= DMA_BIT_MASK(26); /* Use DMA region */
 
-	return -EIO;
+	dev->coherent_dma_mask = mask;
+	return 0;
 }
 
 EXPORT_SYMBOL(ixp4xx_pci_read);
diff --git a/drivers/net/ethernet/xscale/ixp4xx_eth.c b/drivers/net/ethernet/xscale/ixp4xx_eth.c
index 6958a5e..7c08269 100644
--- a/drivers/net/ethernet/xscale/ixp4xx_eth.c
+++ b/drivers/net/ethernet/xscale/ixp4xx_eth.c
@@ -1423,7 +1423,7 @@ static int eth_init_one(struct platform_device *pdev)
 	dev->netdev_ops = &ixp4xx_netdev_ops;
 	dev->ethtool_ops = &ixp4xx_ethtool_ops;
 	dev->tx_queue_len = 100;
-
+	dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32));
 	netif_napi_add(dev, &port->napi, eth_poll, NAPI_WEIGHT);
 
 	if (!(port->npe = npe_request(NPE_ID(port->id)))) {
diff --git a/drivers/net/wan/ixp4xx_hss.c b/drivers/net/wan/ixp4xx_hss.c
index 95d0451..83b4597 100644
--- a/drivers/net/wan/ixp4xx_hss.c
+++ b/drivers/net/wan/ixp4xx_hss.c
@@ -1367,6 +1367,7 @@ static int hss_init_one(struct platform_device *pdev)
 	port->id = pdev->id;
 	port->dev = &pdev->dev;
 	port->plat = pdev->dev.platform_data;
+	dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32));
 	netif_napi_add(dev, &port->napi, hss_hdlc_poll, NAPI_WEIGHT);
 
 	if ((err = register_hdlc_device(dev)))

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

end of thread, other threads:[~2013-04-02  0:40 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-23 19:35 [PATCH] Fix IXP4xx coherent allocations Krzysztof Halasa
2013-03-23 19:35 ` Krzysztof Halasa
2013-03-23 23:57 ` David Miller
2013-03-23 23:57   ` David Miller
2013-03-24 19:11   ` Ben Hutchings
2013-03-24 19:11     ` Ben Hutchings
2013-03-24 21:15     ` Krzysztof Halasa
2013-03-24 21:15       ` Krzysztof Halasa
2013-03-30 13:29       ` Russell King - ARM Linux
2013-03-30 13:29         ` Russell King - ARM Linux
2013-03-30 14:22         ` Krzysztof Halasa
2013-03-30 14:22           ` Krzysztof Halasa
2013-03-30 15:31           ` Russell King - ARM Linux
2013-03-30 15:31             ` Russell King - ARM Linux
2013-04-01 20:17             ` Krzysztof Halasa
2013-04-01 20:17               ` Krzysztof Halasa
2013-04-02  0:40               ` Ben Hutchings
2013-04-02  0:40                 ` Ben Hutchings
2013-03-30 13:18   ` Krzysztof Halasa
2013-03-30 13:18     ` Krzysztof Halasa

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.