forked from mirrors/linux
		
	dma-mapping: arm: use generic pci_set_dma_mask and pci_set_consistent_dma_mask
This converts arm to the generic pci_set_dma_mask and pci_set_consistent_dma_mask (removes HAVE_ARCH_PCI_SET_DMA_MASK for dmabounce). Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Looked-over-by: Russell King <rmk+kernel@arm.linux.org.uk> Cc: Jesse Barnes <jbarnes@virtuousgeek.org> Cc: Greg KH <greg@kroah.com> Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
		
							parent
							
								
									6e6c70e691
								
							
						
					
					
						commit
						6fee48cd33
					
				
					 5 changed files with 8 additions and 59 deletions
				
			
		| 
						 | 
					@ -272,33 +272,6 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
 | 
				
			||||||
		((dma_addr + size - PHYS_OFFSET) >= SZ_64M);
 | 
							((dma_addr + size - PHYS_OFFSET) >= SZ_64M);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * We override these so we properly do dmabounce otherwise drivers
 | 
					 | 
				
			||||||
 * are able to set the dma_mask to 0xffffffff and we can no longer
 | 
					 | 
				
			||||||
 * trap bounces. :(
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * We just return true on everyhing except for < 64MB in which case
 | 
					 | 
				
			||||||
 * we will fail miseralby and die since we can't handle that case.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	dev_dbg(&dev->dev, "%s: %llx\n", __func__, mask);
 | 
					 | 
				
			||||||
	if (mask >= PHYS_OFFSET + SZ_64M - 1)
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return -EIO;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int
 | 
					 | 
				
			||||||
pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	dev_dbg(&dev->dev, "%s: %llx\n", __func__, mask);
 | 
					 | 
				
			||||||
	if (mask >= PHYS_OFFSET + SZ_64M - 1)
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return -EIO;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
 | 
					int __init it8152_pci_setup(int nr, struct pci_sys_data *sys)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	it8152_io.start = IT8152_IO_BASE + 0x12000;
 | 
						it8152_io.start = IT8152_IO_BASE + 0x12000;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -128,6 +128,14 @@ static inline int dma_supported(struct device *dev, u64 mask)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 | 
					static inline int dma_set_mask(struct device *dev, u64 dma_mask)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					#ifdef CONFIG_DMABOUNCE
 | 
				
			||||||
 | 
						if (dev->archdata.dmabounce) {
 | 
				
			||||||
 | 
							if (dma_mask >= ISA_DMA_THRESHOLD)
 | 
				
			||||||
 | 
								return 0;
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								return -EIO;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
	if (!dev->dma_mask || !dma_supported(dev, dma_mask))
 | 
						if (!dev->dma_mask || !dma_supported(dev, dma_mask))
 | 
				
			||||||
		return -EIO;
 | 
							return -EIO;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -502,32 +502,6 @@ struct pci_bus * __devinit ixp4xx_scan_bus(int nr, struct pci_sys_data *sys)
 | 
				
			||||||
	return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys);
 | 
						return pci_scan_bus(sys->busnr, &ixp4xx_ops, sys);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * We override these so we properly do dmabounce otherwise drivers
 | 
					 | 
				
			||||||
 * are able to set the dma_mask to 0xffffffff and we can no longer
 | 
					 | 
				
			||||||
 * trap bounces. :(
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * We just return true on everyhing except for < 64MB in which case 
 | 
					 | 
				
			||||||
 * we will fail miseralby and die since we can't handle that case.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
int
 | 
					 | 
				
			||||||
pci_set_dma_mask(struct pci_dev *dev, u64 mask)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (mask >= SZ_64M - 1 )
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return -EIO;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
int
 | 
					 | 
				
			||||||
pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
	if (mask >= SZ_64M - 1 )
 | 
					 | 
				
			||||||
		return 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	return -EIO;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
EXPORT_SYMBOL(ixp4xx_pci_read);
 | 
					EXPORT_SYMBOL(ixp4xx_pci_read);
 | 
				
			||||||
EXPORT_SYMBOL(ixp4xx_pci_write);
 | 
					EXPORT_SYMBOL(ixp4xx_pci_write);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -26,11 +26,6 @@
 | 
				
			||||||
#define PCIBIOS_MAX_MEM		0x4BFFFFFF
 | 
					#define PCIBIOS_MAX_MEM		0x4BFFFFFF
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*
 | 
					 | 
				
			||||||
 * We override the standard dma-mask routines for bouncing.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
#define	HAVE_ARCH_PCI_SET_DMA_MASK
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#define pcibios_assign_all_busses()	1
 | 
					#define pcibios_assign_all_busses()	1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Register locations and bits */
 | 
					/* Register locations and bits */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -314,7 +314,6 @@ extern unsigned long get_clock_tick_rate(void);
 | 
				
			||||||
#define PCIBIOS_MIN_IO		0
 | 
					#define PCIBIOS_MIN_IO		0
 | 
				
			||||||
#define PCIBIOS_MIN_MEM		0
 | 
					#define PCIBIOS_MIN_MEM		0
 | 
				
			||||||
#define pcibios_assign_all_busses()	1
 | 
					#define pcibios_assign_all_busses()	1
 | 
				
			||||||
#define HAVE_ARCH_PCI_SET_DMA_MASK	1
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue