wl1251: use wiphy_dev instead of wl->spi->dev
[linux/fpc-iii.git] / arch / powerpc / kernel / iomap.c
blob1577434f4088599b4243c96b94a14247397f682f
1 /*
2 * ppc64 "iomap" interface implementation.
4 * (C) Copyright 2004 Linus Torvalds
5 */
6 #include <linux/init.h>
7 #include <linux/pci.h>
8 #include <linux/mm.h>
9 #include <asm/io.h>
10 #include <asm/pci-bridge.h>
13 * Here comes the ppc64 implementation of the IOMAP
14 * interfaces.
16 unsigned int ioread8(void __iomem *addr)
18 return readb(addr);
20 unsigned int ioread16(void __iomem *addr)
22 return readw(addr);
24 unsigned int ioread16be(void __iomem *addr)
26 return in_be16(addr);
28 unsigned int ioread32(void __iomem *addr)
30 return readl(addr);
32 unsigned int ioread32be(void __iomem *addr)
34 return in_be32(addr);
36 EXPORT_SYMBOL(ioread8);
37 EXPORT_SYMBOL(ioread16);
38 EXPORT_SYMBOL(ioread16be);
39 EXPORT_SYMBOL(ioread32);
40 EXPORT_SYMBOL(ioread32be);
42 void iowrite8(u8 val, void __iomem *addr)
44 writeb(val, addr);
46 void iowrite16(u16 val, void __iomem *addr)
48 writew(val, addr);
50 void iowrite16be(u16 val, void __iomem *addr)
52 out_be16(addr, val);
54 void iowrite32(u32 val, void __iomem *addr)
56 writel(val, addr);
58 void iowrite32be(u32 val, void __iomem *addr)
60 out_be32(addr, val);
62 EXPORT_SYMBOL(iowrite8);
63 EXPORT_SYMBOL(iowrite16);
64 EXPORT_SYMBOL(iowrite16be);
65 EXPORT_SYMBOL(iowrite32);
66 EXPORT_SYMBOL(iowrite32be);
69 * These are the "repeat read/write" functions. Note the
70 * non-CPU byte order. We do things in "IO byteorder"
71 * here.
73 * FIXME! We could make these do EEH handling if we really
74 * wanted. Not clear if we do.
76 void ioread8_rep(void __iomem *addr, void *dst, unsigned long count)
78 _insb((u8 __iomem *) addr, dst, count);
80 void ioread16_rep(void __iomem *addr, void *dst, unsigned long count)
82 _insw_ns((u16 __iomem *) addr, dst, count);
84 void ioread32_rep(void __iomem *addr, void *dst, unsigned long count)
86 _insl_ns((u32 __iomem *) addr, dst, count);
88 EXPORT_SYMBOL(ioread8_rep);
89 EXPORT_SYMBOL(ioread16_rep);
90 EXPORT_SYMBOL(ioread32_rep);
92 void iowrite8_rep(void __iomem *addr, const void *src, unsigned long count)
94 _outsb((u8 __iomem *) addr, src, count);
96 void iowrite16_rep(void __iomem *addr, const void *src, unsigned long count)
98 _outsw_ns((u16 __iomem *) addr, src, count);
100 void iowrite32_rep(void __iomem *addr, const void *src, unsigned long count)
102 _outsl_ns((u32 __iomem *) addr, src, count);
104 EXPORT_SYMBOL(iowrite8_rep);
105 EXPORT_SYMBOL(iowrite16_rep);
106 EXPORT_SYMBOL(iowrite32_rep);
108 void __iomem *ioport_map(unsigned long port, unsigned int len)
110 return (void __iomem *) (port + _IO_BASE);
113 void ioport_unmap(void __iomem *addr)
115 /* Nothing to do */
117 EXPORT_SYMBOL(ioport_map);
118 EXPORT_SYMBOL(ioport_unmap);
120 void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
122 resource_size_t start = pci_resource_start(dev, bar);
123 resource_size_t len = pci_resource_len(dev, bar);
124 unsigned long flags = pci_resource_flags(dev, bar);
126 if (!len)
127 return NULL;
128 if (max && len > max)
129 len = max;
130 if (flags & IORESOURCE_IO)
131 return ioport_map(start, len);
132 if (flags & IORESOURCE_MEM)
133 return ioremap(start, len);
134 /* What? */
135 return NULL;
138 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
140 if (isa_vaddr_is_ioport(addr))
141 return;
142 if (pcibios_vaddr_is_ioport(addr))
143 return;
144 iounmap(addr);
147 EXPORT_SYMBOL(pci_iomap);
148 EXPORT_SYMBOL(pci_iounmap);