phy: fixed_phy: Add gpio to determine link up/down.
[linux-2.6/btrfs-unstable.git] / include / asm-generic / pci-dma-compat.h
blobc110843fc53b3f80174496148df8798c866db1b5
1 /* include this file if the platform implements the dma_ DMA Mapping API
2 * and wants to provide the pci_ DMA Mapping API in terms of it */
4 #ifndef _ASM_GENERIC_PCI_DMA_COMPAT_H
5 #define _ASM_GENERIC_PCI_DMA_COMPAT_H
7 #include <linux/dma-mapping.h>
9 static inline int
10 pci_dma_supported(struct pci_dev *hwdev, u64 mask)
12 return dma_supported(hwdev == NULL ? NULL : &hwdev->dev, mask);
15 static inline void *
16 pci_alloc_consistent(struct pci_dev *hwdev, size_t size,
17 dma_addr_t *dma_handle)
19 return dma_alloc_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, dma_handle, GFP_ATOMIC);
22 static inline void *
23 pci_zalloc_consistent(struct pci_dev *hwdev, size_t size,
24 dma_addr_t *dma_handle)
26 return dma_zalloc_coherent(hwdev == NULL ? NULL : &hwdev->dev,
27 size, dma_handle, GFP_ATOMIC);
30 static inline void
31 pci_free_consistent(struct pci_dev *hwdev, size_t size,
32 void *vaddr, dma_addr_t dma_handle)
34 dma_free_coherent(hwdev == NULL ? NULL : &hwdev->dev, size, vaddr, dma_handle);
37 static inline dma_addr_t
38 pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
40 return dma_map_single(hwdev == NULL ? NULL : &hwdev->dev, ptr, size, (enum dma_data_direction)direction);
43 static inline void
44 pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
45 size_t size, int direction)
47 dma_unmap_single(hwdev == NULL ? NULL : &hwdev->dev, dma_addr, size, (enum dma_data_direction)direction);
50 static inline dma_addr_t
51 pci_map_page(struct pci_dev *hwdev, struct page *page,
52 unsigned long offset, size_t size, int direction)
54 return dma_map_page(hwdev == NULL ? NULL : &hwdev->dev, page, offset, size, (enum dma_data_direction)direction);
57 static inline void
58 pci_unmap_page(struct pci_dev *hwdev, dma_addr_t dma_address,
59 size_t size, int direction)
61 dma_unmap_page(hwdev == NULL ? NULL : &hwdev->dev, dma_address, size, (enum dma_data_direction)direction);
64 static inline int
65 pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
66 int nents, int direction)
68 return dma_map_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
71 static inline void
72 pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
73 int nents, int direction)
75 dma_unmap_sg(hwdev == NULL ? NULL : &hwdev->dev, sg, nents, (enum dma_data_direction)direction);
78 static inline void
79 pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle,
80 size_t size, int direction)
82 dma_sync_single_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
85 static inline void
86 pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
87 size_t size, int direction)
89 dma_sync_single_for_device(hwdev == NULL ? NULL : &hwdev->dev, dma_handle, size, (enum dma_data_direction)direction);
92 static inline void
93 pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg,
94 int nelems, int direction)
96 dma_sync_sg_for_cpu(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
99 static inline void
100 pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
101 int nelems, int direction)
103 dma_sync_sg_for_device(hwdev == NULL ? NULL : &hwdev->dev, sg, nelems, (enum dma_data_direction)direction);
106 static inline int
107 pci_dma_mapping_error(struct pci_dev *pdev, dma_addr_t dma_addr)
109 return dma_mapping_error(&pdev->dev, dma_addr);
112 #ifdef CONFIG_PCI
113 static inline int pci_set_dma_mask(struct pci_dev *dev, u64 mask)
115 return dma_set_mask(&dev->dev, mask);
118 static inline int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask)
120 return dma_set_coherent_mask(&dev->dev, mask);
122 #endif
124 #endif