Committer: Michael Beasley <mike@snafu.setup>
[mikesnafu-overlay.git] / include / asm-blackfin / pci.h
blob61277358c8655b64817a37c1e22a2f77ebc0114d
1 /* Changed from asm-m68k version, Lineo Inc. May 2001 */
3 #ifndef _ASM_BFIN_PCI_H
4 #define _ASM_BFIN_PCI_H
6 #include <asm/scatterlist.h>
8 /*
10 * Written by Wout Klaren.
13 /* Added by Chang Junxiao */
14 #define PCIBIOS_MIN_IO 0x00001000
15 #define PCIBIOS_MIN_MEM 0x10000000
17 #define PCI_DMA_BUS_IS_PHYS (1)
18 struct pci_ops;
21 * Structure with hardware dependent information and functions of the
22 * PCI bus.
24 struct pci_bus_info {
27 * Resources of the PCI bus.
29 struct resource mem_space;
30 struct resource io_space;
33 * System dependent functions.
35 struct pci_ops *bfin_pci_ops;
36 void (*fixup) (int pci_modify);
37 void (*conf_device) (unsigned char bus, unsigned char device_fn);
40 #define pcibios_assign_all_busses() 0
41 static inline void pcibios_set_master(struct pci_dev *dev)
44 /* No special bus mastering setup handling */
46 static inline void pcibios_penalize_isa_irq(int irq)
49 /* We don't do dynamic PCI IRQ allocation */
51 static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
52 size_t size, int direction)
54 if (direction == PCI_DMA_NONE)
55 BUG();
57 /* return virt_to_bus(ptr); */
58 return (dma_addr_t) ptr;
61 /* Unmap a single streaming mode DMA translation. The dma_addr and size
62 * must match what was provided for in a previous pci_map_single call. All
63 * other usages are undefined.
65 * After this call, reads by the cpu to the buffer are guarenteed to see
66 * whatever the device wrote there.
68 static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
69 size_t size, int direction)
71 if (direction == PCI_DMA_NONE)
72 BUG();
74 /* Nothing to do */
77 /* Map a set of buffers described by scatterlist in streaming
78 * mode for DMA. This is the scather-gather version of the
79 * above pci_map_single interface. Here the scatter gather list
80 * elements are each tagged with the appropriate dma address
81 * and length. They are obtained via sg_dma_{address,length}(SG).
83 * NOTE: An implementation may be able to use a smaller number of
84 * DMA address/length pairs than there are SG table elements.
85 * (for example via virtual mapping capabilities)
86 * The routine returns the number of addr/length pairs actually
87 * used, at most nents.
89 * Device ownership issues as mentioned above for pci_map_single are
90 * the same here.
92 static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
93 int nents, int direction)
95 if (direction == PCI_DMA_NONE)
96 BUG();
97 return nents;
100 /* Unmap a set of streaming mode DMA translations.
101 * Again, cpu read rules concerning calls here are the same as for
102 * pci_unmap_single() above.
104 static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
105 int nents, int direction)
107 if (direction == PCI_DMA_NONE)
108 BUG();
110 /* Nothing to do */
113 /* Make physical memory consistent for a single
114 * streaming mode DMA translation after a transfer.
116 * If you perform a pci_map_single() but wish to interrogate the
117 * buffer using the cpu, yet do not wish to teardown the PCI dma
118 * mapping, you must call this function before doing so. At the
119 * next point you give the PCI dma address back to the card, the
120 * device again owns the buffer.
122 static inline void pci_dma_sync_single(struct pci_dev *hwdev,
123 dma_addr_t dma_handle, size_t size,
124 int direction)
126 if (direction == PCI_DMA_NONE)
127 BUG();
129 /* Nothing to do */
132 /* Make physical memory consistent for a set of streaming
133 * mode DMA translations after a transfer.
135 * The same as pci_dma_sync_single but for a scatter-gather list,
136 * same rules and usage.
138 static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
139 struct scatterlist *sg, int nelems,
140 int direction)
142 if (direction == PCI_DMA_NONE)
143 BUG();
145 /* Nothing to do */
148 #endif /* _ASM_BFIN_PCI_H */